Hi. I have hacked a sunscreen remote, and created a cloud variable switch up and down.
The code gives a pulse signal High, then goes low. The problem is that the google cloud switch doesn't show that it switches back to low. It's always on after pushing it. I have to turn it off to turn it on again. Is there any way to have google read the actuall output itself?
Here's my code. Sorry if Newbie and English is my second language.
#include "thingProperties.h"
void setup() {
Serial.begin(9600);
delay(1500);
pinMode(1,OUTPUT);
pinMode(2,OUTPUT);
initProperties();
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
}
void loop() {
ArduinoCloud.update();
}
void onUpChange() {
if(up==true)
{digitalWrite(1,HIGH);}
delay(500);
{digitalWrite(1,LOW);}
}
void onDownChange() {
if(down==true)
{digitalWrite(2,HIGH);}
delay(500);
{digitalWrite(2,LOW);}
}