APOLOGIES DID SOME MORE SEARCHING AND FOUND CODE RELATED TO BLINK LED , SOLVED MY ISSUE. Now to add reed switches /notification on closed/Open and alerts.
Hi, very new to coding and automation of any sort. Thought now would be good to dip my toe. Had a spare pi b+ v3 laying around and thought i would try to automate my ageing garage door. Found this thread Particle/Google assistant and worked my way through with great results. However , being this is for switching a light on , it doesnt quite match what i need. i.e. I need a momentary button/voice push to simulate garage door button push. I have tried to amend the code below to include items such as “delay(1000);” but still only able to switch relay permanently on or perma off. Any help would be appreciated .
int relay = D1; //pin to which relay is connected
int boardLed = D7;
bool vin = LOW; //a virtual boolean variable
// setup() is run only once, it's where we set up GPIO and //initialise peripherals
void setup() {
// Setup GPIO
pinMode(relay,OUTPUT); // relay pin is set as output
digitalWrite(relay,HIGH);
// Subscribe to events published by IFTTT using Particle.subscribe
Particle.subscribe("Name_of_The_Event-1", myHandler);
//turning off function declaration
Particle.subscribe("Name_of_The_Event-2", thisHandler);
//turning on function declaration
}
// loop() runs continuously, it's our infinite loop.
void loop() {
if (vin==HIGH){
digitalWrite(relay,LOW);
}
else if (vin==LOW){
digitalWrite(relay,HIGH);
}
}
//our events are called when IFTTT applets are triggered
void myHandler(const char *event, const char *data){
vin=LOW;
}
void thisHandler(const char *event, const char *data){
vin=HIGH;
}