#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define PANTALLA_ANCHO 128
#define PANTALLA_LARGO 64
#define OLED_RESET -1
Adafruit_SSD1306 display(PANTALLA_ANCHO, PANTALLA_LARGO, &Wire, OLED_RESET);
void setup() {
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("Fallo en la inicialización de la pantalla OLED"));
for (;;);
}
display.clearDisplay();
}
void loop() {
display.clearDisplay();
int RNX = random(7,121); // rango del eje x contando el ancho de la pelota
int RNY = random(7,57); // rango del eje y
display.fillCircle(RNX, RNY, 8, WHITE);
display.display();
delay(300);
}
Loading
ssd1306
ssd1306