#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Wire.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
const int juan=17;// Pin del botón conectado a Arduino
// Define la matriz de píxeles para la imagen que deseas mostrar
const unsigned char PROGMEM logo_bmp[
00000000000000000000000000
00000000000000000000000000
00000000000000000000000000
00000000011111111000000000
00000001111111111110000000
00000011111111111111100000
00000111111111111111110000
00001111111111111101110000
00011111111111111111111000
00011111111111111101111100
00111111111111111111111100
00111111111111111111111100
01111111111111111111111110
01111111111111111111111110
01111111111111111111111110
01111111111100111111111110
01111110011111111000111110
01111100001111110000111110
01111100001111110000111110
01111110001111111001111110
01111111111111111111111110
01111111111111111111111110
01111111111111111111111110
01110111111111111111111110
00111110111111111101111100
00111101111111111110111100
00111101111111111111011100
00011111111111111111111000
00011111111011101111111000
00001111111111111111111000
00001111111111111111110000
00000111111011101111100000
00000011111111111111100000
00000011111111111111000000
00000000111111111110000000
00000000011111111100000000
00000000000111100000000000
00000000000000000000000000
00000000000000000000000000
00000000000000000000000000] = {
// Inserta tu matriz de píxeles aquí
// Por ejemplo:
// 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
// 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
// ...
};
void setup() {
Serial.begin(9600);
pinMode(juan, INPUT_PULLUP);
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("No se encontró el display OLED"));
while(true);
}
display.clearDisplay();
display.display();
}
void loop() {
int buttonState = digitalRead(juan);
if(buttonState == HIGH) {
display.clearDisplay();
// Mostrar la imagen en la pantalla OLED
display.drawBitmap(0, 0,logo_bmp , SCREEN_WIDTH, SCREEN_HEIGHT, WHITE);
display.display();
delay(1000); // Esperar un segundo antes de borrar la pantalla
}
else {
display.clearDisplay();
display.display();
}
}