minuteur-esp/src/main.cpp

47 lines
794 B
C++
Raw Normal View History

#include <Arduino.h>
2023-09-02 18:54:12 +02:00
//#include <Wire.h>
#include <OLED_I2C.h>
2023-09-02 18:54:12 +02:00
#define SDA 12
#define SCL 13
OLED myOLED(SDA, SCL);
2023-09-02 19:18:39 +02:00
extern uint8_t BigNumbers[];
2023-09-02 19:18:39 +02:00
#define SORTIE_ALIM 4
#define LED_FLASH 4
#define LED_BUILTIN 33
2023-09-02 18:54:12 +02:00
#define MyLED LED_FLASH
2023-09-02 19:18:39 +02:00
int count = 7;
bool sortieAlim = false;
void setup() {
2023-09-02 19:18:39 +02:00
pinMode(SORTIE_ALIM, OUTPUT);
digitalWrite(SORTIE_ALIM, LOW);
2023-09-02 18:54:12 +02:00
myOLED.begin(SSD1306_128X32);
2023-09-02 19:18:39 +02:00
myOLED.setFont(BigNumbers);
2023-09-02 18:54:12 +02:00
myOLED.clrScr();
myOLED.print("Hello, world!", CENTER, 0);
myOLED.update();
}
2023-09-02 19:18:39 +02:00
void loop() {
2023-09-02 19:18:39 +02:00
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);
}