Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using WiringPI c-lib in QB64
#2
Since you didn't get any responses I took a stab at it. This works to use the library via `Declare Library`:

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.
Reply


Messages In This Thread
Using WiringPI c-lib in QB64 - by Rudy M - 07-02-2024, 08:56 AM
RE: Using WiringPI c-lib in QB64 - by DSMan195276 - 07-07-2024, 08:12 PM
RE: Using WiringPI c-lib in QB64 - by Rudy M - 07-08-2024, 08:43 AM



Users browsing this thread: 1 Guest(s)