Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SPI.h>
- #include <Wire.h>
- #include <Adafruit_GFX.h>
- #include <Adafruit_SSD1306.h>
- int OLED_RESET = 4;
- Adafruit_SSD1306 display(OLED_RESET);
- void setup() {
- Serial.begin(9600);
- display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
- delay(1000);
- display.clearDisplay();
- Serial.print("Display: ");
- Serial.print(display.width());
- Serial.print("x");
- Serial.println(display.height());
- }
- void loop() {
- drawRandomBitmap();
- }
- void drawRandomBitmap() {
- for (int x = 0; x < display.width(); x++) {
- for (int y = 0; y < display.height(); y++) {
- display.drawPixel(x, y, ((rand() & 0x01) == 0) ? WHITE : BLACK);
- }
- }
- display.display();
- Serial.println("refreshed");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement