parent
2fefed97e5
commit
f7c1d4dee9
2 changed files with 13 additions and 28 deletions
1
firmware/config.h
Executable file → Normal file
1
firmware/config.h
Executable file → Normal file
|
@ -18,4 +18,3 @@ const char *INFLUXDB_USER = "oko";
|
|||
const char *INFLUXDB_PASS = "de1873a0d2f8f21f17cf4d8db4f65c59";
|
||||
|
||||
String DEVICE_NAME = "aaron";
|
||||
|
||||
|
|
40
firmware/firmware.ino
Executable file → Normal file
40
firmware/firmware.ino
Executable file → Normal file
|
@ -3,7 +3,7 @@
|
|||
#include <DNSServer.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
#include <WiFiManager.h>
|
||||
#include <ESP8266Influxdb.h> // https://github.com/hwwong/ESP8266Influxdb auchecken und code+header in das firmware verzeichnis kopieren
|
||||
#include <ESP8266Influxdb.h>
|
||||
#include <Adafruit_Sensor.h> // Adafruit Unified Sensor
|
||||
#include <Adafruit_APDS9960.h> // https://github.com/adafruit/Adafruit_APDS9960
|
||||
#include <Adafruit_BME280.h> // https://github.com/adafruit/Adafruit_BME280_Library
|
||||
|
@ -62,47 +62,33 @@ void setup() {
|
|||
delay(2000);
|
||||
|
||||
// Initialize and configure the sensors
|
||||
apds.begin();
|
||||
apds.enableColor(true);
|
||||
|
||||
bool status = bme.begin(0x76);
|
||||
if (!status) {
|
||||
Serial.println("Could not find a valid BME280 sensor, check wiring!");
|
||||
while (1);
|
||||
}
|
||||
//apds.begin();
|
||||
//apds.enableColor(true);
|
||||
//bme.begin();
|
||||
|
||||
delay(100);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
digitalWrite(STATUS_LED_PIN, LOW);
|
||||
|
||||
#ifdef DEBUG
|
||||
Serial.println("---");
|
||||
digitalWrite(STATUS_LED_PIN, HIGH);
|
||||
#endif
|
||||
|
||||
currentSensorData[SENSOR_TEMPERATURE] = fetchTemperature();
|
||||
Serial.print("*");
|
||||
currentSensorData[SENSOR_HUMIDITY] = fetchHumidity();
|
||||
Serial.print("*");
|
||||
//currentSensorData[SENSOR_HUMIDITY] = fetchHumidity();
|
||||
//currentSensorData[SENSOR_LIGHT] = fetchLight();
|
||||
Serial.print("*");
|
||||
currentSensorData[SENSOR_WINDSPEED] = fetchWindspeed();
|
||||
Serial.print("*");
|
||||
currentSensorData[SENSOR_PRESSURE] = fetchPressure();
|
||||
Serial.println("*");
|
||||
//currentSensorData[SENSOR_WINDSPEED] = fetchWindspeed();
|
||||
//currentSensorData[SENSOR_PRESSURE] = fetchPressure();
|
||||
|
||||
#ifdef DEBUG
|
||||
Serial.println("");
|
||||
Serial.println("Current readings:");
|
||||
Serial.println("Temperature: " + String(currentSensorData[SENSOR_TEMPERATURE]) + " °C");
|
||||
Serial.println("Humidity: " + String(currentSensorData[SENSOR_HUMIDITY]) + " %");
|
||||
Serial.println("Light: " + String(currentSensorData[SENSOR_LIGHT]) + " Lumen");
|
||||
Serial.println("Windspeed: " + String(currentSensorData[SENSOR_WINDSPEED]) + " Km/h");
|
||||
Serial.println("Pressure: " + String(currentSensorData[SENSOR_PRESSURE]) + " hPa");
|
||||
//Serial.println("Humidity: " + String(currentSensorData[SENSOR_HUMIDITY]) + "%");
|
||||
//Serial.println("Light: " + String(currentSensorData[SENSOR_LIGHT]) + " Lumen");
|
||||
//Serial.println("Windspeed: " + String(currentSensorData[SENSOR_WINDSPEED]) + " Km/h");
|
||||
//Serial.println("Pressure: " + String(currentSensorData[SENSOR_PRESSURE]) + " hPa");
|
||||
#endif
|
||||
|
||||
pushToInfluxDB(DEVICE_NAME, currentSensorData);
|
||||
|
||||
delay(UPDATE_INTERVAL*1000);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue