Version vom 28.12.2019
This commit is contained in:
parent
266d1c552f
commit
7de92d6e2b
|
@ -6,12 +6,13 @@
|
|||
#include <Wire.h>
|
||||
#include <Adafruit_Sensor.h>
|
||||
#include <Adafruit_BME280.h>
|
||||
#include "DHT.h"
|
||||
|
||||
#define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT
|
||||
#define ETH_PHY_POWER 12
|
||||
|
||||
const char* wifi_ssid = "ssid";
|
||||
const char* wifi_password = "passord";
|
||||
const char* wifi_ssid = "36C3-things";
|
||||
const char* wifi_password = "congress2019";
|
||||
|
||||
static bool eth_connected = false;
|
||||
|
||||
|
@ -30,26 +31,31 @@ WebServer WebServer_Server(80);
|
|||
|
||||
Adafruit_BME280 BME280_Sensor;
|
||||
|
||||
#define DHTPIN 0
|
||||
#define DHTTYPE DHT11
|
||||
DHT dht(DHTPIN, DHTTYPE);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200); // RS232
|
||||
Wire.begin (13, 16); // I²C Init
|
||||
pinMode (34, INPUT); // User Button
|
||||
Ticker_ReadSensors.attach(15, ReadSensors);
|
||||
Ticker_Service.attach(1, Service);
|
||||
dht.begin();
|
||||
|
||||
Serial.println("Starting...");
|
||||
|
||||
/* WiFi.begin(wifi_ssid, wifi_password);
|
||||
WiFi.begin(wifi_ssid, wifi_password);
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
delay(500);
|
||||
Serial.print(".");
|
||||
}
|
||||
Serial.println("WiFi connected");
|
||||
Serial.println("IP address: ");
|
||||
Serial.println(WiFi.localIP()); */
|
||||
Serial.println(WiFi.localIP());
|
||||
|
||||
WiFi.onEvent(EthEvent);
|
||||
ETH.begin();
|
||||
/* WiFi.onEvent(EthEvent);
|
||||
ETH.begin();*/
|
||||
|
||||
WebServer_Server.on("/", handleRoot);
|
||||
WebServer_Server.on("/metrics", handleMetrics);
|
||||
|
@ -86,12 +92,22 @@ void ReadSensors() {
|
|||
temperature = BME280_Sensor.readTemperature();
|
||||
pressure = (BME280_Sensor.readPressure() / 100.0F);
|
||||
humidity = BME280_Sensor.readHumidity();
|
||||
Serial.print("\nTemperature: ");
|
||||
Serial.print("\nBME280 Temperature: ");
|
||||
Serial.print(temperature);
|
||||
Serial.print(", Pressure: ");
|
||||
Serial.print("°C, Humidity: ");
|
||||
Serial.print(humidity);
|
||||
Serial.print("%, Pressure: ");
|
||||
Serial.print(pressure);
|
||||
Serial.print(", Humidity: ");
|
||||
Serial.println(humidity);
|
||||
Serial.println("hPa");
|
||||
|
||||
float h = dht.readHumidity();
|
||||
float t = dht.readTemperature();
|
||||
|
||||
Serial.print(F("DHT11 Temperature: "));
|
||||
Serial.print(t);
|
||||
Serial.print(F("°C, Humidity: "));
|
||||
Serial.print(h);
|
||||
Serial.println(F("%"));
|
||||
}
|
||||
|
||||
/* Eth Interface */
|
||||
|
|
Loading…
Reference in New Issue