MiniKEYS/MiniKEYS.ino
Pierre Guillod 4eeea5c52d
code + doc
* First push of the codebase
* Dependencies & hardware documentation
2023-07-27 13:15:05 +02:00

40 lines
739 B
C++

#include "Adafruit_NeoKey_1x4.h"
#include "seesaw_neopixel.h"
#include <Keyboard.h>
Adafruit_NeoKey_1x4 neokey;
void setup() {
Keyboard.begin();
if (! neokey.begin(0x30)) {
Serial.println("No peripheral detected.");
while(1) delay(10);
}
}
void loop() {
uint8_t buttons = neokey.read();
if (buttons & (1<<3)) {
Keyboard.press(KEY_HOME);
} else {
Keyboard.release(KEY_HOME);
}
if (buttons & (1<<2)) {
Keyboard.press(KEY_PAGE_UP);
} else {
Keyboard.release(KEY_PAGE_UP);
}
if (buttons & (1<<1)) {
Keyboard.press(KEY_PAGE_DOWN);
} else {
Keyboard.release(KEY_PAGE_DOWN);
}
if (buttons & (1<<0)) {
Keyboard.press(KEY_END);
} else {
Keyboard.release(KEY_END);
}
}