#include <Adafruit_SSD1306.h> // Include the Adafruit SSD1306 library
// Initialize an SSD1306 display object
Adafruit_SSD1306 display(128, 64, &Wire);
void setup() {
Wire.begin(); // Initialize I2C communication
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Initialize with the I2C address 0x3C
display.clearDisplay(); // Clear the display buffer
}
void loop() {
display.clearDisplay(); // Clear previous content
// Display text on the OLED display
display.setTextSize(2); // Set text size
display.setTextColor(SSD1306_WHITE); // Set text color
display.setCursor(0, 0); // Set cursor position
display.println("Sunil");
display.display(); // Update the display
delay(1000); // Delay for one second (adjust as necessary)
}
No comments:
Post a Comment