microrobotics icon

Untitled

microrobotics | PRO | 07/27/23 01:11:42 PM UTC | 0 ⭐ | 1275 👁️ | Never ⏰ | []
Arduino |

850 B

|

None

|

0 👍

/

0 👎

#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
}

Comments