Hi, Could anyone check what’s wrong with this code ?
[CODE]var BlynkLib = require(‘blynk-library’);
var blynk = new BlynkLib.Blynk(’***’);
var Gpio = require(‘onoff’).Gpio,
relay = new Gpio(21, ‘out’);
var button = new blynk.VirtualPin(1);
button.on(‘write’, function(param) {
console.log(‘V1:’, param);
relay.writeSync(param.toString());
});
[/CODE]
I know this isn’t necessary as the pin works out of the box , but I wanted to do more with the button press.
Sorry for that , didn’t realize I didn’t state the problem in the post.
Yes , the write function is not invoked,
however if I put the write function outside button.on it works.