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
Suggested Topics
-
Day 1 - Status report
Announcements ā¢ 23 Mar 2014, 22:45 ā¢ hek 24 Mar 2014, 20:12 -
Can not compile MySensors on esp8266
Troubleshooting ā¢ 24 Aug 2024, 15:35 ā¢ TheoL 29 Aug 2024, 20:47 -
Raspberry Pi 5: invalid GPIO 9
Troubleshooting ā¢ 27 Aug 2024, 13:20 ā¢ igo 27 Aug 2024, 13:20 -
JSN SR04T - Temperature Influencing Readings
Troubleshooting ā¢ 6 Sept 2019, 07:51 ā¢ Timbergetter 4 days ago -
Getting system time from the controller
Troubleshooting ā¢ 27 Feb 2025, 01:39 ā¢ dpcons 30 days ago -
Echo request is not set
Troubleshooting ā¢ 12 Aug 2024, 15:36 ā¢ kamilb85 3 Sept 2024, 08:58