Get string data
-
String sentData = ""
send: 51-51-0-0 s=1,c=1,t=2,pt=2,l=2,st=ok:1How can i put this serial monitor print to sentData ?
-
Is it impossible?
-
Sorry, I don't understand.
-
@C.r.a.z.y. said:
String sentData = ""
send: 51-51-0-0 s=1,c=1,t=2,pt=2,l=2,st=ok:1How can i put this serial monitor print to sentData ?
are you looking to log these serial outputs as Strings?
-
@BulldogLowell Yes
-
Maybe i am asking wrong;
If there is "fail"send: 51-51-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
it will reboot
if (re.indexOf("fail") >=0)
{
asm volatile (" jmp 0"); //reboot
}Why i need this; because i cant turn on or off my lights when sketch failed.
-
@C.r.a.z.y. said:
if (re.indexOf("fail") >=0)
{
asm volatile (" jmp 0"); //reboot
}sorry for asking this, but is this the code for reboot?
does it work?
-
Maybe one day someone will use this;
**When sketch fails second push will work without gateway and it will restart
**void loop()
{
gw.process();
debouncer.update();
value = debouncer.read();if (value != oldValue && value==0) {
if (re!="1")
{
int oku=digitalRead(RELAY_PIN);
if(oku==1)
{
digitalWrite(RELAY_PIN,0);
}
else
{
digitalWrite(RELAY_PIN,1);
}
asm volatile (" jmp 0"); //reboot
}
gw.send(msg.set(state?false:true),true); // Send new state and request ack back
re="";
}
oldValue = value;
}void incomingMessage(const MyMessage &message) {
state = message.getBool();
digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF);
gw.saveState(CHILD_ID, state);
Serial.print("Incoming change for sensor:");
Serial.print(message.sensor);
Serial.print(", New status: ");
Serial.println(message.getBool());
re=String(message.sensor);
}
-
@C.r.a.z.y. Thanks for the code, very useful, coz I've found out is that i have to restart my pro mini every couple of days...
-
@funky81 Hek can make better but he didnt understand as you see