I have very little programming skills, so copy and paste is my skill level.
I could not figure out how to post code in code blocks (sorry first post)
what happens is that I post one data set, it is all zeros, then it never posts again.
using the Arduino IDE
I have to imagine that this has been asked dozens of times. I looked for an FAQ and searched posts, but have not come accross this answer.
/*
Copyright (c) 2015, Embedded Adventures
All rights reserved. www.embeddedadventures.com
*/
// BME280 MOD-1022 weather multi-sensor Arduino demo
// Written originally by Embedded Adventures
#include "UbidotsMicroESP8266.h"
#define TOKEN "6xzaYIyzzYXmTJuh5SBrvCROpOYoIv" // Put here your Ubidots TOKEN
#define WIFISSID "***********" // SSID is hidden
#define PASSWORD "**********" // password is hidden
#include <BME280_MOD-1022.h>
#include <Wire.h>
void printFormattedFloat(float x, uint8_t precision) {
char buffer[10];
dtostrf(x, 7, precision, buffer);
Serial.print(buffer);
}
// print out the measurements
float T1, humidity, pressure;
int then;
void printCompensatedMeasurements(void) {
float temp, pressureMoreAccurate;
double tempMostAccurate, humidityMostAccurate, pressureMostAccurate;
char buffer[80];
temp = BME280.getTemperature();
T1 = ((temp * 9) / 5) + 32;
humidity = BME280.getHumidity();
pressure = BME280.getPressure();
pressureMoreAccurate = BME280.getPressureMoreAccurate(); // t_fine already calculated from getTemperaure() above
tempMostAccurate = BME280.getTemperatureMostAccurate();
humidityMostAccurate = BME280.getHumidityMostAccurate();
pressureMostAccurate = BME280.getPressureMostAccurate();
// Serial.println(" Good Better Best");
Serial.print("Temperature ");
// printFormattedFloat(temp, 2);
// Serial.print(" ");
printFormattedFloat(tempMostAccurate, 2);
Serial.print(" ");
Serial.print(T1);
Serial.println();
Serial.print("Humidity ");
// printFormattedFloat(humidity, 2);
// Serial.print(" ");
printFormattedFloat(humidityMostAccurate, 2);
Serial.println();
Serial.print("Pressure ");
// printFormattedFloat(pressure, 2);
// Serial.print(" ");
// printFormattedFloat(pressureMoreAccurate, 2);
// Serial.print(" ");
printFormattedFloat(pressureMostAccurate, 2);
Serial.println();
}
}
// setup wire and serial
Ubidots client(TOKEN);
void setup() //++++++++++++++++++++++++++++++++ SETUP ++++++++++++++++
{
Wire.begin();
Serial.begin(115200);
client.wifiConnection(WIFISSID, PASSWORD);
then = millis();
}
// main loop
void loop()
{