#include #include #include #include #define SCREEN_WIDTH 128 #define SCREEN_HEIGHT 32 #define OLED_RESET -1 Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); const int buttonCopyPin = 0; // Pin for the copy button const int buttonPastePin = 1; // Pin for the paste button const int buttonScrollUpPin = 2; // Pin for the page scroll up button const int buttonScrollDownPin = 3; // Pin for the page scroll down button const int buttonEnterPin = 6; // Pin for the enter button void setup() { // Initialize the OLED display if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { Serial.println(F("SSD1306 allocation failed")); for(;;); } display.display(); delay(2000); display.clearDisplay(); // Initialize the buttons pinMode(buttonCopyPin, INPUT_PULLUP); pinMode(buttonPastePin, INPUT_PULLUP); pinMode(buttonScrollUpPin, INPUT_PULLUP); pinMode(buttonScrollDownPin, INPUT_PULLUP); pinMode(buttonEnterPin, INPUT_PULLUP); // Initialize the Keyboard library Keyboard.begin(); } void loop() { if (digitalRead(buttonCopyPin) == LOW) { display.clearDisplay(); display.setTextSize(3); display.setTextColor(SSD1306_WHITE); display.setCursor(20, 5); display.print("Copy"); display.display(); Keyboard.press(KEY_LEFT_CTRL); Keyboard.press('c'); delay(100); Keyboard.releaseAll(); delay(500); // Debounce delay } if (digitalRead(buttonPastePin) == LOW) { display.clearDisplay(); display.setTextSize(3); display.setTextColor(SSD1306_WHITE); display.setCursor(20, 5); display.print("Paste"); display.display(); Keyboard.press(KEY_LEFT_CTRL); Keyboard.press('v'); delay(100); Keyboard.releaseAll(); delay(500); // Debounce delay } if (digitalRead(buttonScrollUpPin) == LOW) { display.clearDisplay(); display.setTextSize(2); display.setTextColor(SSD1306_WHITE); display.setCursor(10, 5); display.print("Scroll UP"); display.display(); Keyboard.press(KEY_PAGE_UP); delay(100); Keyboard.releaseAll(); delay(500); // Debounce delay } if (digitalRead(buttonScrollDownPin) == LOW) { display.clearDisplay(); display.setTextSize(2); display.setTextColor(SSD1306_WHITE); display.setCursor(10, 5); // Adjusted cursor position display.print("Scroll Down"); display.display(); Keyboard.press(KEY_PAGE_DOWN); delay(100); Keyboard.releaseAll(); delay(500); // Debounce delay } if (digitalRead(buttonEnterPin) == LOW) { display.clearDisplay(); display.setTextSize(3); display.setTextColor(SSD1306_WHITE); display.setCursor(25, 5); display.print("Enter"); display.display(); Keyboard.press(KEY_RETURN); delay(100); Keyboard.releaseAll(); delay(500); // Debounce delay } }