Der BMP280 liefert Werte von 96000.00 hPa… Programm wurde mit Blockly (nicht mit der Betaversion) ersellt.
Vielleicht hat mir jemand einen guten Rat. Gruß und Dank Nick
#include „SenseBoxMCU.h“
const long interval = 60000;
long time_start = 0;
long time_actual = 0;
Bee* b = new Bee();
HDC1080 hdc;
const char SENSOR_ID[] PROGMEM = „“;
VEML6070 veml;
TSL45315 tsl;
static const uint8_t NUM_SENSORS = 5;
const char SENSEBOX_ID [] PROGMEM = „“;
const char server [] PROGMEM =„ingress.opensensemap.org“;
WiFiClient client;
typedef struct measurement {
const char *sensorId;
float value;
} measurement;
char buffer[750];
measurement measurements[NUM_SENSORS];
uint8_t num_measurements = 0;
const int lengthMultiplikator = 35;
void addMeasurement(const char *sensorId, float value) {
measurements[num_measurements].sensorId = sensorId;
measurements[num_measurements].value = value;
num_measurements++;
}
void writeMeasurementsToClient() {
// iterate throug the measurements array
for (uint8_t i = 0; i < num_measurements; i++) {
sprintf_P(buffer, PSTR("%s,%9.2f\n"), measurements[i].sensorId,
measurements[i].value);
// transmit buffer to client
client.print(buffer);
}
// reset num_measurements
num_measurements = 0;
}
float getWindspeed(){
float voltageWind = analogRead(A1) * (3.3 / 1024.0);
float windspeed = 0.0;
if (voltageWind >= 0.018){
float poly1 = pow(voltageWind, 3);
poly1 = 17.0359801998299 * poly1;
float poly2 = pow(voltageWind, 2);
poly2 = 47.9908168343362 * poly2;
float poly3 = 122.899677524413 * voltageWind;
float poly4 = 0.657504127272728;
windspeed = poly1 - poly2 + poly3 - poly4;
windspeed = windspeed * 0.2777777777777778; //conversion in m/s
}
return windspeed;
}
void submitValues() {
if (client.connected()) {
client.stop();
delay(10);
}
bool connected = false;
char _server[strlen_P(server)];
strcpy_P(_server, server);
for (uint8_t timeout = 2; timeout != 0; timeout–) {
Serial.println(F(„connecting…“));
connected = client.connect(_server, 80);
if (connected == true) {
// construct the HTTP POST request:
sprintf_P(buffer,
PSTR("POST /boxes/%s/data HTTP/1.1\nAuthorization: \nHost: %s\nContent-Type: "
„text/csv\nConnection: close\nContent-Length: %i\n\n“),
SENSEBOX_ID, server, num_measurements * lengthMultiplikator);
// send the HTTP POST request:
client.print(buffer);
// send measurements
writeMeasurementsToClient();
// send empty line to end the request
client.println();
uint16_t timeout = 0;
// allow the response to be computed
while (timeout <= 5000) {
delay(10);
timeout = timeout + 10;
if (client.available()) {
break;
}
}
num_measurements = 0;
break;
}
if (connected == false) {
// Reset durchführen
delay(5000);
noInterrupts();
NVIC_SystemReset();
while (1)
;
}
}
}
void setup() {
b->connectToWifi("");
delay(1000);
hdc.begin();
veml.begin();
tsl.begin();
}
void loop() {
time_start = millis();
if (time_start > time_actual + interval) {
time_actual = millis();
addMeasurement(SENSOR_ID,hdc.getTemperature());
addMeasurement(SENSOR_ID,hdc.getHumidity());
addMeasurement(SENSOR_ID,veml.getUvIntensity());
addMeasurement(SENSOR_ID,tsl.getIlluminance());
addMeasurement(SENSOR_ID,getWindspeed());
submitValues();
}
}