#include <Arduino.h> #include <ittiot.h> #define RELAY_PIN 5 // If message received switch relay void iot_received(String topic, String msg) { Serial.print("MSG FROM USER callback, topic: "); Serial.print(topic); Serial.print(" payload: "); Serial.println(msg); if(msg == "1") { digitalWrite(RELAY_PIN, HIGH); } if(msg == "0") { digitalWrite(RELAY_PIN, LOW); } } void iot_connected() { Serial.println("MQTT connected callback"); iot.subscribe("relay"); iot.log("IoT relay example!"); } void setup() { Serial.begin(115200); Serial.println("Booting"); iot.printConfig(); // print json config to serial //Peale Serial.begin ja enne iot.setup iot.setup(); pinMode(RELAY_PIN, OUTPUT); } void loop() { iot.handle(); delay(200); }