#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
char symbol[3] = {'!', '?', '+'};
int currentPhrase = 0;
void setup() {
Serial.begin(115200);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
// Attach the interrupt to the button pin
attachInterrupt(digitalPinToInterrupt(2), displaymic, CHANGE);
}
void displaymic() {
// This function will be called when the interrupt is triggered by the button release
delay(50); // Add a delay of 50ms for debouncing
currentPhrase++;
if (currentPhrase == 3) {
currentPhrase = 0;
}
}
void loop() {
display.clearDisplay();
display.setCursor(44, 0);
display.write(symbol[currentPhrase]);
display.display();
}