Sebuahhobi98

send and get multiple data with serial wemos and uno

Jul 9th, 2019
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. //send
  2. byte data[2];
  3. data[0] = volume_json;
  4. data[1] = relay_json;
  5. Serial.write(data, 2 );
  6.  
  7. //read
  8. byte incomingBytes[2];
  9. if (Serial.available()) { // If anything comes in Serial (USB),
  10. for (int i = 0; i < 3; i++) {
  11. incomingBytes[i] = Serial.read();
  12. }
  13. Serial.println(incomingBytes[0]);
  14. Serial.println(incomingBytes[1]);
  15. }
Add Comment
Please, Sign In to add comment