/** * MQTT callback to process received messages */ void callback(char* topic, byte* payload, unsigned int length) { int strcomparison = strcmp(topic, mqttTopicTemperature); if (strcomparison == 0) { Serial.println("Matched Temperature Topic"); if (payload[2] == '.') { length = 4; } for (int i=0;i 0) { int inChar = Serial.read(); if (isDigit(inChar)) { // convert the incoming byte to a char // and add it to the string: inString += (char)inChar; } // if you get a newline, print the string, // then the string's value: if (inChar == '\n') { Serial.print("Value:"); Serial.println(inString.toInt()); Serial.print("String: "); Serial.println(inString); // clear the string for new input: inString = ""; } } }