#include <Arduino.h>
#include <U8g2lib.h> // u8g2 library for drawing on OLED display - needs to be installed in Arduino IDE first
#include <Wire.h> // wire library for IIC communication with the OLED display
//U8G2_SSD1306_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0); // set the OLED display to 128x64px, HW IIC, no rotation, used in WOKWI
U8G2_SH1107_128X128_1_HW_I2C u8g2(U8G2_R0); // final display, 128x128px [page buffer, size = 128 bytes], HW IIC connection
// IIC connection of the OLED display and Arduino UNO
// +5V > +5V
// GND > GND
// SCL (serial clock) > A5 or SCL
// SDA (serial data) > A4 or SDA
void setup(void) {
u8g2.begin(); // begin the u8g2 library
u8g2.setContrast(255); // set display contrast/brightness
}
void loop(void) {
u8g2.firstPage(); // select the first page of the display (page is 128x8px), since we are using the page drawing method of the u8g2 library
do {
// Line 1 - using font u8g2_font_ncenB14_tr
u8g2.setFont(u8g2_font_ncenB14_tr); // set the u8g2 font
u8g2.drawStr(20, 20, "ARVIND"); // draw the string at (x, y)
// Line 2 - using font u8g2_font_helvB10_tr
u8g2.setFont(u8g2_font_helvB10_tr); // set the u8g2 font
u8g2.drawStr(35, 40, "INDIA"); // draw the string at (x, y)
// Line 3 - using font u8g2_font_courB08_tr
u8g2.setFont(u8g2_font_courB08_tr); // set the u8g2 font
u8g2.drawStr(35, 60, "Nandurbar"); // draw the string at (x, y)
// Line 4 - using font u8g2_font_6x10_tf
u8g2.setFont(u8g2_font_6x10_tf); // set the u8g2 font
u8g2.drawStr(30, 80, "7020336035"); // draw the string at (x, y)
} while (u8g2.nextPage()); // go over all the pages until the whole display is updated
delay(1000); // wait for 1 second before refreshing the display
}
अरविन्द पाटील यांचे text on oled 24/5/24
https://wokwi.com/projects/398645500196353025