microrobotics

Untitled

Jul 27th, 2023
555
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Adafruit_GFX.h>
  2. #include <Adafruit_SSD1351.h>
  3. #include <SPI.h>
  4.  
  5. #define OLED_CS    10
  6. #define OLED_RST   9
  7. #define OLED_DC    8
  8.  
  9. // Initialize the OLED library
  10. Adafruit_SSD1351 display(OLED_CS, OLED_DC, OLED_RST);
  11.  
  12. void setup() {
  13.   // Initialize the display
  14.   display.begin();
  15.   display.fillScreen(BLACK); // Clear the screen
  16.   display.setTextColor(WHITE); // Set text color to white
  17.   display.setTextSize(1); // Set text size
  18.   display.setCursor(10, 20); // Set the starting position for the text
  19. }
  20.  
  21. void loop() {
  22.   // Display "hello world" on the OLED screen
  23.   display.println("Hello World!");
  24.   display.display(); // Show the text on the screen
  25.   delay(1000); // Delay for 1 second before clearing the screen
  26.   display.fillScreen(BLACK); // Clear the screen
  27.   delay(1000); // Delay for 1 second before displaying "hello world" again
  28. }
Add Comment
Please, Sign In to add comment