Got some Scala bindings for WiringPi thanks to SN-Bindgen (plus some manual adjustments)
https://gist.github.com/JD557/c81ad69f7506c70a5c26e9ddec24db27
Took me quite some time to get things to work... but at least I got a blinking LED today :
import wiringpi.all.*
println("Starting")
wiringPiSetup()
val led = 25
pinMode(led, OUTPUT)
while(true) {
println("ON")
digitalWrite(led, HIGH)
Thread.sleep(1000)
println("OFF")
digitalWrite(led, LOW)
Thread.sleep(1000)
}
I do need to figure out how to cross compile before I try something more complex... Scala Native compilation on a Raspberry Pi 3 B is SLOW!
One stupid reason why this took so long. Somehow when connecting the LED, not only did I read the pinout wrong (transposed), but I also had a off-by-one pin connection.
This connected the ground to another ground (the Raspberry Pi has a bunch of those) but the output pin was connected to the 5V output.
And dumb me, instead of figuring out the obvious, assumed that "if the LED is on, the circuit is fine" and spent a bunch of time trying to figure out why the pins were defaulting to HIGH and why I couldn't set them to LOW