daily pastebin goal
26%
SHARE
TWEET

Untitled

a guest Jan 17th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top