Any Java/Blynk/RPi experts with nothing by free time out there?
I have been slogging through Google and Github trying to make sense out of what I guess is Java when using Node.js and Blynk.
I have a mixture of the test script provided by @vshymanskyy (showing the seconds in the App and showing a Virtual Button status on the CLI), mixed in with some direct pin manipulation (successfully controlling an LED and dual relay board) and my recent attempts to read a physical button on the RPi.
Two issues I have noticed…
First issue: (EDIT: This has been RESOLVED - see below) I added a Virtual LED to the Virtual Button toggle… and it works, sorta… it does toggle the state ON/OFF, but the colour stays black (even though I have it set to match the Button colour orange). I guess it works differently in Java. So any idea how to set the LED value in java as it is clearly not the usual Blynk type commands as listed in the DOCs for C++
v1.on('write', function(param) {
console.log('V1:', param[0]);
v10.write(param[0]); // This turns on or off the Virtual LED - but not showing preset colour?
});
Second issue: I am trying to determine the state of a physical button on (Pin 22, GPIO 6, BCM 25 - it is enough to drive one bonkers ) )
After digging through the directions on this page pi-gpio - npm EDIT - This appears to be an old and near dead option… don’t use!
2nd EDIT - And has been SOLVED by using the already installed onoff library. - jump to comment below.
I was able to install the pi-gpio library and mess around with commands until I got the script to run, even though it throws an error… but of course nothing happens when I press the physical button.
EDIT - I have removed the code that I had pasted here, since it was no good anyhow… no sense confusing everyone
At this point, I don’t know my button’s state, but I am clearly in a drooling state