Affichage d'un décompte sur OLED

This commit is contained in:
Laurent Claude 2023-09-02 19:18:39 +02:00
parent 434e49d8d8
commit d3ee50d2ec

View File

@ -6,26 +6,42 @@
#define SCL 13 #define SCL 13
OLED myOLED(SDA, SCL); OLED myOLED(SDA, SCL);
extern uint8_t SmallFont[]; extern uint8_t BigNumbers[];
#define SORTIE_ALIM 4
#define LED_FLASH 4 #define LED_FLASH 4
#define LED_BUILTIN 33 #define LED_BUILTIN 33
#define MyLED LED_FLASH #define MyLED LED_FLASH
int count = 7;
bool sortieAlim = false;
void setup() { void setup() {
pinMode(MyLED, OUTPUT); pinMode(SORTIE_ALIM, OUTPUT);
digitalWrite(SORTIE_ALIM, LOW);
myOLED.begin(SSD1306_128X32); myOLED.begin(SSD1306_128X32);
myOLED.setFont(SmallFont); myOLED.setFont(BigNumbers);
myOLED.clrScr(); myOLED.clrScr();
myOLED.print("Hello, world!", CENTER, 0); myOLED.print("Hello, world!", CENTER, 0);
myOLED.update(); myOLED.update();
} }
void loop() { void loop() {
/*digitalWrite(MyLED, HIGH); digitalWrite(SORTIE_ALIM, HIGH);
delay(10);
digitalWrite(MyLED, LOW); for (int i = count; i > 0; i--)
delay(990); */ {
char cstr[16];
itoa(i, cstr, 10);
myOLED.clrScr();
myOLED.print(cstr, CENTER, 0);
myOLED.update();
delay(1000);
}
digitalWrite(SORTIE_ALIM, LOW);
delay(1000);
} }