All, I cannot seem to get the data from a BMP280 sensor to the cloud console. I assume it has something to do with my code, please help…
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <ThingerWifi.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Adafruit_BMP280.h>
Adafruit_BMP280 bme; // I2C
#define USERNAME “xxxxxx” //thingerio username
#define DEVICE_ID “xxxxxxx” //thingerio device name
#define DEVICE_CREDENTIAL “xxxxxx” //thingerio pass
#define SSID “xxxxxxx” //wifi name
#define SSID_PASSWORD “xxxxxx” //wifi pass
#define ONE_WIRE_BUS 3
unsigned long lastCheck = 0;
float Temperature;
float ABSPressure;
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);// Pass our oneWire reference to Dallas Temperature.
// Assign the addresses of 1-Wire ds18b20 temp sensors.
DeviceAddress T0 = { 0x28, 0xEE, 0xCE, 0xAF, 0x1D, 0x16, 0x02, 0x37 }; //on board temp
DeviceAddress T1 = { 0x28, 0xF2, 0xC1, 0x60, 0x09, 0x00, 0x00, 0xF3 }; //water temp
//DeviceAddress T2 = { TBA }; //spare temp input not currently used
DeviceAddress T3 = { 0x28, 0xEE, 0xEC, 0x8C, 0x1D, 0x16, 0x02, 0xB4 }; //outside temp
ThingerWifi thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
void setup() {
thing.add_wifi(SSID, SSID_PASSWORD);
Wire.begin(D3, D4);
thing[“Temperature”] >> [](pson & out) {
out[“Temp”] = bme.readTemperature();
};
thing[“ABSPressure”] >> [](pson & out) {
out[“ABSPress”] = bme.readPressure ();
};
thing[“temps”] >> [](pson & out) {
sensors.requestTemperatures(); // Send the command to get temperatures
out[“T0”] = sensors.getTempC(T0)- 6.34; //on board temp, temp adjusted by - 6.34 DegC to match T1 & T3
out[“T1”] = sensors.getTempC(T1); //water temp
out[“T1F”] = sensors.getTempC(T1)* 9/5 +32; //water temp in F
//out[“T2”] = sensors.getTempC(T2); //spare temp input not currently used
out[“T3”] = sensors.getTempC(T3); //outside temp
};
}
void loop() {
thing.handle();
unsigned long currentTs = millis(); //water temp notification
if (currentTs - lastCheck >= 60 * 60 * 1000) { //checks condition every hour
lastCheck = currentTs;
if (sensors.getTempC(T1)* 9/5 +32 <= 95) { //send email if water temp is lower than 95 (35 Deg C)
thing.call_endpoint(“Email”);
}
}
if (currentTs - lastCheck >= 60 * 60 * 1000) { //checks condition every hour
lastCheck = currentTs;
if (sensors.getTempC(T0) > 27) { //send email if onboard temp is greater than 27 Deg C
thing.call_endpoint(“Email1”);
}
}
}