Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int foo = String((char*)payload).indexOf(' ');
- int message1;
- int message2;
- message1 = String((char*)payload).substring(0, foo).toInt();
- Serial.print(message1); // Returns 1
- message2 = String((char*)payload).substring(foo + 1, length).toInt();
- Serial.print(message2); // Returns 0
- client.publish(msg, String(message1 + " " + message2).c_str(), true);
- // published value: 1 0
Add Comment
Please, Sign In to add comment