07-07-2024, 08:12 PM
Since you didn't get any responses I took a stab at it. This works to use the library via `Declare Library`:
With basic usage looking something like this:
Obviously I haven't included the definitions of every function provided by wiringPi, but adding more functions isn't too hard. You'll want to read the header file here and convert the function definitions you need into ones for QB64 and place them in the `Declare Library` section. You'll probably also want to turn the `#define FOO 0` lines into `CONST FOO = 0` to make the library nicer to use.
Code: (Select All)
Declare Library "wiringPi"
Function wiringPiSetup&()
Sub pinMode(ByVal pin As Long, ByVal mode As Long)
Function digitalRead&(ByVal pin As Long)
Sub digitalWrite(ByVal pin As Long, ByVal value As Long)
End Declare
With basic usage looking something like this:
Code: (Select All)
e& = wiringPiSetup&
pinMode 0, 1 ' Pin 0 for Output
digitalWrite 0, 1
pinMode 0, 0 ' Pin 0 for Input
d& = digitalRead&(0)
Obviously I haven't included the definitions of every function provided by wiringPi, but adding more functions isn't too hard. You'll want to read the header file here and convert the function definitions you need into ones for QB64 and place them in the `Declare Library` section. You'll probably also want to turn the `#define FOO 0` lines into `CONST FOO = 0` to make the library nicer to use.