Guest User

Untitled

a guest
Jan 17th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. int foo = String((char*)payload).indexOf(' ');
  2. int message1;
  3. int message2;
  4.  
  5. message1 = String((char*)payload).substring(0, foo).toInt();
  6. Serial.print(message1); // Returns 1
  7.  
  8. message2 = String((char*)payload).substring(foo + 1, length).toInt();
  9. Serial.print(message2); // Returns 0
  10.  
  11. client.publish(msg, String(message1 + " " + message2).c_str(), true);
  12. // published value: 1 0
Add Comment
Please, Sign In to add comment