Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Thinger.io
Published

ESP8266 digital read (ds18b20) with Thinger.io

How to digital read with Thinger.io

BeginnerProtip30 minutes2,439
ESP8266 digital read (ds18b20) with Thinger.io

Things used in this project

Software apps and online services

Thinger.io Platform
Thinger.io Platform

Story

Read more

Code

Untitled file

Arduino
    #include < OneWire.h>
    #include < DallasTemperature.h>
    #include < SPI.h>
    #include < ESP8266WiFi.h>
    #include < ThingerWifi.h>

    #define ONE_WIRE_BUS 12 // Data wire is plugged into port 2 on the Arduino
    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature sensors(&oneWire);// Pass our oneWire reference to Dallas Temperature.

    #define USERNAME "your_user_name"
    #define DEVICE_ID "your_device_id"
    #define DEVICE_CREDENTIAL "your_device_credential"

    #define SSID "your_wifi_ssid"
    #define SSID_PASSWORD "your_wifi_ssid_password"

    ThingerWifi thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);

    void setup() {
    pinMode(BUILTIN_LED, OUTPUT);

    thing.add_wifi(SSID, SSID_PASSWORD);

    thing["temp"] >> [](pson & out) {
    sensors.requestTemperatures(); // Send the command to get temperatures
    out["TEMPERATURA"] = sensors.getTempCByIndex(0);
    };

    sensors.begin();
    }

    void loop(void) {
    thing.handle();

    }

Credits

Thinger.io
3 projects • 8 followers
Contact

Comments

Please log in or sign up to comment.