Auteur Titouan L | Dernière modification 6/01/2021 par Pierre Muller
Station_m_t_o_qui_a_le_groove_IMG_20201210_165837_resized_20201210_045906951.jpg
#include "Seeed_BME280.h"
#include <Wire.h>
#include "SH1106Wire.h"
#include <ESP8266WiFi.h>
#include <ESPDash.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <Servo.h>
BME280 bme280;
SH1106Wire display(0x3c, D2, D1);
AsyncWebServer server(80);
ESPDash dashboard(&server);
Card temperature(&dashboard, TEMPERATURE_CARD, "Temperature", "°C");
Card humidity(&dashboard, HUMIDITY_CARD, "Humidity", "%");
Card pressure(&dashboard, GENERIC_CARD, "Pression", "mB");
Servo myservo;
void setup()
{
myservo.attach(D6);
Serial.begin(9600);
bme280.init();
display.init();
WiFi.softAP("mon resseau", "mot de passe");
server.begin();
WiFi.begin("SSID BOX", "mot de passe");
Serial.print("Connection en cours");
while (WiFi.status() != WL_CONNECTED) // tant que l'esp n'est pas connecté au réseau on attends
{
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print("Connecté, 192.168.4.1 : ");
Serial.println(WiFi.localIP()); // affichage de l'adresse IP
}
void loop()
{
float temp = bme280.getTemperature();
Serial.println(temp);
display.clear();
display.drawString(0,0, String (temp));
float Pressure = bme280.getPressure();
Serial.println(Pressure);
display.drawString(0,10, String (Pressure));
int Altitude = bme280.calcAltitude(Pressure);
Serial.println(Altitude);
display.drawString(0,20, String (Altitude));
int Humidity = bme280.getHumidity();
Serial.println(Humidity);
display.drawString(0,40, String (Humidity));
display.drawString(0,30, "Humidity");
display.display();
delay(1000);
temperature.update(temp);
humidity.update(Humidity);
pressure.update(Pressure);
dashboard.sendUpdates();
int temp_map = map(temp,5,25,0,180);
myservo.write(temp_map);
delay(3000);
}
Dernière modification 6/01/2021 par user:Pierre Muller.
Draft
Vous avez entré un nom de page invalide, avec un ou plusieurs caractères suivants :
< > @ ~ : * € £ ` + = / \ | [ ] { } ; ? #