2023-09-02 17:55:13 +02:00
|
|
|
#include <Arduino.h>
|
2023-09-02 18:54:12 +02:00
|
|
|
//#include <Wire.h>
|
|
|
|
#include <OLED_I2C.h>
|
2023-09-02 17:55:13 +02:00
|
|
|
|
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 20:12:26 +02:00
|
|
|
extern uint8_t SmallFont[];
|
2023-09-02 17:55:13 +02:00
|
|
|
|
2023-09-02 19:18:39 +02:00
|
|
|
#define SORTIE_ALIM 4
|
2023-09-02 17:55:13 +02:00
|
|
|
#define LED_FLASH 4
|
|
|
|
#define LED_BUILTIN 33
|
2023-09-02 18:54:12 +02:00
|
|
|
#define MyLED LED_FLASH
|
2023-09-02 17:55:13 +02:00
|
|
|
|
2023-09-02 19:18:39 +02:00
|
|
|
int count = 7;
|
|
|
|
bool sortieAlim = false;
|
|
|
|
|
|
|
|
|
2023-09-02 17:55:13 +02:00
|
|
|
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 20:12:26 +02:00
|
|
|
myOLED.setFont(SmallFont);
|
2023-09-02 18:54:12 +02:00
|
|
|
myOLED.clrScr();
|
2023-09-02 20:12:26 +02:00
|
|
|
myOLED.print("Hello", CENTER, 0);
|
2023-09-02 18:54:12 +02:00
|
|
|
myOLED.update();
|
2023-09-02 20:12:26 +02:00
|
|
|
delay(1000);
|
2023-09-02 17:55:13 +02:00
|
|
|
}
|
|
|
|
|
2023-09-02 19:18:39 +02:00
|
|
|
|
2023-09-02 17:55:13 +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);
|
2023-09-02 20:12:26 +02:00
|
|
|
|
|
|
|
myOLED.setFont(BigNumbers);
|
2023-09-02 19:18:39 +02:00
|
|
|
myOLED.clrScr();
|
|
|
|
myOLED.print(cstr, CENTER, 0);
|
|
|
|
myOLED.update();
|
|
|
|
delay(1000);
|
|
|
|
}
|
2023-09-02 20:12:26 +02:00
|
|
|
|
|
|
|
myOLED.setFont(SmallFont);
|
|
|
|
myOLED.clrScr();
|
|
|
|
myOLED.print("OFF", CENTER, 0);
|
|
|
|
myOLED.update();
|
2023-09-02 19:18:39 +02:00
|
|
|
digitalWrite(SORTIE_ALIM, LOW);
|
|
|
|
delay(1000);
|
2023-09-02 17:55:13 +02:00
|
|
|
}
|