Difference between revisions of "ArduinoNano 096OLED.ino"
| Line 3: | Line 3: | ||
<b>code pour Arduino</b> | <b>code pour Arduino</b> | ||
| + | |||
| + | <pre> | ||
| + | #include <Arduino.h> | ||
| + | #include <U8g2lib.h> | ||
| + | |||
| + | #ifdef U8X8_HAVE_HW_SPI | ||
| + | #include <SPI.h> | ||
| + | #endif | ||
| + | #ifdef U8X8_HAVE_HW_I2C | ||
| + | #include <Wire.h> | ||
| + | #endif | ||
| + | |||
| + | U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0,A5,A4,U8X8_PIN_NONE); | ||
| + | |||
| + | void setup(void) { | ||
| + | u8g2.begin(); | ||
| + | } | ||
| + | |||
| + | void loop(void) { | ||
| + | u8g2.clearBuffer(); | ||
| + | u8g2.setFont(u8g2_font_ncenB08_tr); | ||
| + | u8g2.drawStr(0,10,"ideaspark 0.96" OLED"); | ||
| + | u8g2.drawStr(0,25,"0.96"); | ||
| + | u8g2.drawStr(0,35,"0.96 inch"); | ||
| + | u8g2.drawStr(0,45,"0.96 inch OLED"); | ||
| + | u8g2.drawStr(0,55,"0.96 inch OLED 128x64"); | ||
| + | u8g2.sendBuffer(); | ||
| + | delay(1000); | ||
| + | }</pre> | ||
| + | |||
| + | |||
| + | <b>code pour ESP32</b> testé avec la carte 30 PIN de Aliexpress | ||
<pre> | <pre> | ||
Revision as of 17:42, 31 December 2024
https://wiki.myows.cyou/index.php?title=0.96_OLED
code pour Arduino
#include <Arduino.h>
#include <U8g2lib.h>
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0,A5,A4,U8X8_PIN_NONE);
void setup(void) {
u8g2.begin();
}
void loop(void) {
u8g2.clearBuffer();
u8g2.setFont(u8g2_font_ncenB08_tr);
u8g2.drawStr(0,10,"ideaspark 0.96" OLED");
u8g2.drawStr(0,25,"0.96");
u8g2.drawStr(0,35,"0.96 inch");
u8g2.drawStr(0,45,"0.96 inch OLED");
u8g2.drawStr(0,55,"0.96 inch OLED 128x64");
u8g2.sendBuffer();
delay(1000);
}
code pour ESP32 testé avec la carte 30 PIN de Aliexpress
#include <Arduino.h>
#include <U8g2lib.h>
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0,A5,A4,U8X8_PIN_NONE);
void setup(void) {
u8g2.begin();
}
void loop(void) {
u8g2.clearBuffer();
u8g2.setFont(u8g2_font_ncenB08_tr);
u8g2.drawStr(0,10,"ideaspark 0.96" OLED");
u8g2.drawStr(0,25,"0.96");
u8g2.drawStr(0,35,"0.96 inch");
u8g2.drawStr(0,45,"0.96 inch OLED");
u8g2.drawStr(0,55,"0.96 inch OLED 128x64");
u8g2.sendBuffer();
delay(1000);
}