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 ?
-
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?
-
Is it impossible?
-
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 ?
@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?
-
@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 :+1:
-
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.
-
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.
-
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);
} -
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 :-1:
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login