From 434e49d8d877b684b7230975da974da8df5658e6 Mon Sep 17 00:00:00 2001 From: Laurent Claude Date: Sat, 2 Sep 2023 18:54:12 +0200 Subject: [PATCH] Hello sur OLED --- platformio.ini | 5 ++++- src/main.cpp | 24 ++++++++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/platformio.ini b/platformio.ini index 993dc81..32fc407 100644 --- a/platformio.ini +++ b/platformio.ini @@ -11,4 +11,7 @@ [env:esp32cam] platform = espressif32 board = esp32cam -framework = arduino \ No newline at end of file +framework = arduino +lib_deps = + poma/OLED_I2C @ ^2.12 + diff --git a/src/main.cpp b/src/main.cpp index 19691e5..cb3ae26 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,19 +1,31 @@ #include +//#include +#include +#define SDA 12 +#define SCL 13 + +OLED myOLED(SDA, SCL); +extern uint8_t SmallFont[]; -// Un petit Hello world pour valider les bases #define LED_FLASH 4 #define LED_BUILTIN 33 - -#define MyLED LED_BUILTIN +#define MyLED LED_FLASH void setup() { pinMode(MyLED, OUTPUT); + + myOLED.begin(SSD1306_128X32); + myOLED.setFont(SmallFont); + myOLED.clrScr(); + myOLED.print("Hello, world!", CENTER, 0); + myOLED.update(); } void loop() { - digitalWrite(MyLED, HIGH); - delay(1000); + /*digitalWrite(MyLED, HIGH); + delay(10); digitalWrite(MyLED, LOW); - delay(1000); + delay(990); */ + } \ No newline at end of file