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 -
Getting system time from the controller
Troubleshooting • 27 Feb 2025, 01:39 • dpcons 27 days ago -
Compiling Sensor code using BME280 and ESP8266
Troubleshooting • 26 Feb 2025, 00:32 • dpcons 26 Feb 2025, 06:22 -
JSN SR04T - Temperature Influencing Readings
Troubleshooting • 6 Sept 2019, 07:51 • Timbergetter a day ago -
Raspberry Pi 5: invalid GPIO 9
Troubleshooting • 27 Aug 2024, 13:20 • igo 27 Aug 2024, 13:20 -
NODs stop responding, but ping works.
Troubleshooting • 21 days ago • Marcin 21 days ago