Last active
January 29, 2016 14:50
-
-
Save chaeplin/d5b0e870335a24aa000d to your computer and use it in GitHub Desktop.
callback.ino
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void callback(char* topic, byte* payload, unsigned int length) { | |
String receivedtopic = topic; | |
String receivedpayload ; | |
for (int i = 0; i < length; i++) { | |
receivedpayload += (char)payload[i]; | |
} | |
Serial.print(receivedtopic); | |
Serial.print(" => "); | |
Serial.println(receivedpayload); | |
if ( receivedtopic == "inside") { | |
lcd.setBacklight(HIGH); | |
lcd.display(); | |
lcd.home (); // set cursor to 0,0 | |
lcd.print ("Inside is: "); | |
lcd.setCursor (13, 0); | |
lcd.print(receivedpayload); | |
} | |
if ( receivedtopic == "outside") { | |
lcd.setCursor (0, 1); | |
lcd.print ("Outside is: "); | |
lcd.setCursor (13, 1); | |
lcd.print(receivedpayload); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment