Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. void callback(char* topic, byte* payload, unsigned int length) {
  2. for (int i=0;i<length;i++) {
  3. payload[length] = '\0';
  4.  
  5. cstring = (char *) payload;
  6. }
  7. // Serial.println(topic); //This is the topic
  8. // Serial.println(cstring); //this is the payload
  9. request = atof(cstring);
  10.  
  11. if (strstr(topic, "setpoint") != NULL) {
  12. for (unsigned i = 0; i < sizeof(sensor_list) / sizeof(Sensor); i++) {
  13. char row = i;
  14. if (strstr(topic, row) != NULL) {
  15. setpoint = atof(cstring);
  16. sensor_list[i].setpoint = setpoint;
  17. }
  18. }
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement