#include <Adafruit_SSD1306.h>
#include <splash.h>
#define bitmap_height 128
#define bitmap_width 64
#include <Wire.h>
#include <Adafruit_GFX.h>
#define YELLOW 0xFFE0
#define OLED_RESET -1
Adafruit_SSD1306 display(OLED_RESET);
int buttonState1 = 0;
const int BUTTON_PIN1 = 2;
int toggle = 0;
const unsigned char s1 [] PROGMEM = {
};
const unsigned char s2 [] PROGMEM = {
};
void setup() {
pinMode(BUTTON_PIN1, INPUT_PULLUP);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
}
void loop() {
buttonState1 = digitalRead(BUTTON_PIN1);
if (buttonState1 == LOW) {
if (toggle ==0) {
display.clearDisplay();
display.drawBitmap(0, 0, s1, bitmap_height, bitmap_width, WHITE);
display.display();
toggle = 1;
}
else {
display.clearDisplay();
display.drawBitmap(0, 0, s2, bitmap_height, bitmap_width, WHITE);
display.display();
toggle = 0;
}
}
}
0 comments:
Yorum Gönder