- i search in the forum but i can´t find the right answer
- i also check the documentation but everythink i try does not work
- Add details :
• Raspberry 3b +
• iPhone X
• Blynk server
Hello together,
i have a problem with my actual project. Its the first project i try with blynk so my coding skills are not the best
I read a lot of documentation and tutorials but the most of them are are difficult to understand at the beginning.
I want to open and close my garage door via Blynk. In addition, a reed sensor should be used to check if the door is closed. This query also works with the code.
Now I want to control a Gpio with a button which controls the motor via a relay.
Can someone tell me what I have to add to the code so that the button of the app controls the Gpio.
Most of the code is from a tutorial but I hope you can add a button here.
Thanks for your answers.
var AUTH = 'XXX'
var blynk = new blynklib.Blynk(AUTH)
var Gpio = require('onoff').Gpio,
antrieb = new Gpio (22, 'out')
reed = new Gpio (17, 'in', 'both'), // register wechselt 'both', wenn der Schalter geöffnet und geschlossen wird.
led = new Gpio (7, 'out');
var virtualPin = 0;
reed.watch(function (err,value) {
led.writeSync(value)
if(value==1){
blynk.virtualWrite(virtualPin,"Tor geschlossen");
console.log('Tor geschlossen');
};
if (value==0){
blynk.virtualWrite(virtualPin,"Tor offen");
console.log('Tor geöffnet');
//blynk.notify("Garagentor ist jetzt geschlossen!");
};
});
process.on ('SIGINT', function () {
led.unexport ();
reed.unexport ();
});