Compare commits
2 Commits
ecf8711e54
...
dev_D1Mini
Author | SHA1 | Date | |
---|---|---|---|
bc904d4f01 | |||
8cd2ee3943 |
16
README.md
16
README.md
@ -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
|
||||

|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 179 KiB |
12
src/main.cpp
12
src/main.cpp
@ -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;
|
||||
@ -53,7 +54,12 @@ void setup() {
|
||||
pinMode(ENCROT_BP, INPUT);
|
||||
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);
|
||||
|
Reference in New Issue
Block a user