#define THINGER_SERIAL_DEBUG
#define THINGER_FREE_RTOS
#include <ThingerESP32.h>
//#include "arduino_secrets.h"
ThingerESP32 thing("mijimy", "esp32_test", "12345678");
#define led 15
void setup() {
// open serial for debugging
Serial.begin(115200);
pinMode(led, OUTPUT);
thing.add_wifi("Wokwi-GUEST", "");
// resource output example (i.e. reading a sensor value)
thing["millis"] >> outputValue(millis());
// digital pin control example (i.e. turning on/off a light, a relay, configuring a parameter, etc)
thing["led"] << digitalPin(4);
// resource output example (i.e. reading a sensor value)
thing["millis"] >> outputValue(millis());
thing["data"] >> [](pson& out) {
out["temperature"] = read_temp;
out["millis"] = millis();
};
// start thinger on its own task
thing.start();
// more details at http://docs.thinger.io/arduino/
}
void loop() {
// use loop as in normal Arduino Sketch
// use thing.lock() thing.unlock() if using variables exposed on thinger resources
read_temp = 35 + random(1, 10);
digitalWrite(led, HIGH);
delay(500);
digitalWrite(led, LOW);
delay(500);
}