Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Adafruit_GFX.h>
- #include <Adafruit_SSD1351.h>
- #include <SPI.h>
- #define OLED_CS 10
- #define OLED_RST 9
- #define OLED_DC 8
- // Initialize the OLED library
- Adafruit_SSD1351 display(OLED_CS, OLED_DC, OLED_RST);
- void setup() {
- // Initialize the display
- display.begin();
- display.fillScreen(BLACK); // Clear the screen
- display.setTextColor(WHITE); // Set text color to white
- display.setTextSize(1); // Set text size
- display.setCursor(10, 20); // Set the starting position for the text
- }
- void loop() {
- // Display "hello world" on the OLED screen
- display.println("Hello World!");
- display.display(); // Show the text on the screen
- delay(1000); // Delay for 1 second before clearing the screen
- display.fillScreen(BLACK); // Clear the screen
- delay(1000); // Delay for 1 second before displaying "hello world" again
- }
Add Comment
Please, Sign In to add comment