Compare commits

..

2 Commits

Author SHA1 Message Date
bc904d4f01 Mémorisation dernière durée en EEPROM 2023-09-07 12:51:38 +02:00
8cd2ee3943 maj readme et schema pour D1mini 2023-09-05 13:02:29 +02:00
3 changed files with 23 additions and 5 deletions

View File

@ -1,7 +1,17 @@
# Minuteur
Basé sur un ESP32-CAM, pour interrompre une alimentation USB (via transistor ou relais ?).
Basé sur un ESP8266 D1 Mini Wemos, pour interrompre une alimentation USB (via transistor ou relais ?).
Temps réglable (MM:SS), boutons poussoirs ou encodeur rotatif, mini afficheur oled.
Temps réglable en secondes.
Utilisation d'un encodeur rotatif, d'un mini afficheur oled et d'un module relais.
## Schéma de principe
# Environnement
VSCodium et PlatformIO
## Librairies utilisées
adafruit/Adafruit SSD1306@^2.5.7
adafruit/Adafruit GFX Library@^1.11.7
mathertel/RotaryEncoder@^1.5.3
*Voir le fichier platformio.ini pour les dernières mise à jour.*
## Schéma
![principe](./doc/schema_principe.jpg)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 179 KiB

View File

@ -4,6 +4,7 @@
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <RotaryEncoder.h>
#include <EEPROM.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
@ -27,7 +28,7 @@ RotaryEncoder encoder(ENCROT_A, ENCROT_B, RotaryEncoder::LatchMode::TWO03);
// durée par défaut en secondes
int count = 12;
int count;
bool statutDecompte = 0;
unsigned long LastUpdateTimer = 0;
unsigned long LastReadBP = 0;
@ -54,6 +55,11 @@ void setup() {
pinMode(SORTIE_RELAIS, OUTPUT);
digitalWrite(SORTIE_RELAIS, LOW);
//Init EEPROM
EEPROM.begin(1);
EEPROM.get(0, count);
//Init I2C
Wire.begin(SDA, SCL); // join i2c bus (address optional for master)
Serial.begin(115200); // start serial for output
@ -129,6 +135,8 @@ void loop() {
statutDecompte = !statutDecompte;
if (statutDecompte) {
LastUpdateTimer = currentMillis;
EEPROM.put(0, count);
EEPROM.commit();
}
else {
encoder.setPosition(count);