Hi everybody, please i need your help so bad!
i need to connect a device with thinger. the first step is ok, I made to connect it from a sketch I found online link and other from the community.
When I try to adapt it to my project, just adding a sensor, (without calling any function… just #include the library, it doesn’t connect.
#define DEBUG // Grazie a questi finalmente si e’ connesso, dopo infiniti tentativi
#define DISABLE_TLS
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <ThingerESP8266.h>
#include “DHT.h”
//#include <HX711.h> //appena lo attivi, non si connette piu… boh??
#define USERNAME “sistralsrl”
#define DEVICE_ID “test2”
#define DEVICE_CREDENTIAL “test1234”
ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
#define SSID “Rigert”
#define SSID_PASSWORD “albinoniE45”
int timer = 0;
//int freq = 20;
#define DHTPIN D2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
//#define sezione1_DOUT_PIN D6
//#define sezione1_SCK_PIN D7
//HX711 sezione1(sezione1_DOUT_PIN, sezione1_SCK_PIN);
void setup() {
// Setup WiFi
thing.add_wifi(SSID, SSID_PASSWORD);
// Define the ‘thing’ with a name and data direction
thing[“dht11”] >> [](pson& out){
// Add the values and the corresponding code
out[“humidity”] = dht.readHumidity();
out[“celsius”] = dht.readTemperature();
//out[“Hx711”] = sezione1.readvalue();
};
}
void loop() {
thing.handle();
if(millis()>timer+(60000*1)) { //call each “freq” minutes
thing.write_bucket(“BucketIFR”, “dht11”); //call thinger.io endpoint function and attacht the pson (ID Bucket, thing)
timer = millis(); //actualize time counter
}
}