Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SPI.h>
- #include <ESP8266WiFi.h>
- #include <ThingerWifi.h>
- #define USERNAME "username"
- #define DEVICE_ID "deviceid"
- #define DEVICE_CREDENTIAL "devicecredentials"
- #define SSID "networkName"
- #define SSID_PASSWORD "networkPassword"
- ThingerWifi thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
- void setup() {
- pinMode(0, OUTPUT);
- pinMode(1, OUTPUT);
- thing.add_wifi(SSID, SSID_PASSWORD);
- // resource input example (i.e. turning on/off a light, a relay, configuring a parameter, etc)
- thing["bojler"] << [](pson& in){ digitalWrite(0, in ? HIGH : LOW); };
- // resource input example (i.e. turning on/off a light, a relay, configuring a parameter, etc)
- thing["vrata"] << [](pson& in){ digitalWrite(2, in ? HIGH : LOW); };
- }
- void loop() {
- thing.handle();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement