Advertisement
rozman50

sendTemperature

May 4th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. void sendTemperature() {
  2. radio.stopListening();
  3. radio.openWritingPipe(addresses[0]);
  4.  
  5.  
  6. String temperature = String(temp) + ".50";
  7.  
  8. // FORMAT:
  9. // TMP= + temperature in format (00.00) + Node1
  10. // TMP=23.50Mastr
  11. String sendData = "TMP=" + temperature + nodeAddress;
  12. Serial.println("data to send: " + sendData);
  13.  
  14. sendData.toCharArray(dataToSend, 32);
  15.  
  16. radio.write(&dataToSend, sizeof(dataToSend));
  17. radio.startListening();
  18. memset(dataToSend, 0, sizeof(dataToSend));
  19. sendData = "";
  20.  
  21. if (temp == 45) temp = 10;
  22. temp++;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement