From d3ee50d2ecf7130bd3e08d8f7be8fddece00324c Mon Sep 17 00:00:00 2001 From: Laurent Claude Date: Sat, 2 Sep 2023 19:18:39 +0200 Subject: [PATCH] =?UTF-8?q?Affichage=20d'un=20d=C3=A9compte=20sur=20OLED?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.cpp | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index cb3ae26..bbedf28 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,26 +6,42 @@ #define SCL 13 OLED myOLED(SDA, SCL); -extern uint8_t SmallFont[]; +extern uint8_t BigNumbers[]; +#define SORTIE_ALIM 4 #define LED_FLASH 4 #define LED_BUILTIN 33 #define MyLED LED_FLASH +int count = 7; +bool sortieAlim = false; + + void setup() { - pinMode(MyLED, OUTPUT); + pinMode(SORTIE_ALIM, OUTPUT); + digitalWrite(SORTIE_ALIM, LOW); myOLED.begin(SSD1306_128X32); - myOLED.setFont(SmallFont); + myOLED.setFont(BigNumbers); myOLED.clrScr(); myOLED.print("Hello, world!", CENTER, 0); myOLED.update(); } + void loop() { - /*digitalWrite(MyLED, HIGH); - delay(10); - digitalWrite(MyLED, LOW); - delay(990); */ - + digitalWrite(SORTIE_ALIM, HIGH); + + for (int i = count; i > 0; i--) + { + char cstr[16]; + itoa(i, cstr, 10); + + myOLED.clrScr(); + myOLED.print(cstr, CENTER, 0); + myOLED.update(); + delay(1000); + } + digitalWrite(SORTIE_ALIM, LOW); + delay(1000); } \ No newline at end of file