AI Keyboard (Kiro version)
Print Profile(1)
Description
You will need a RP2024 chip and 3 keys.
Be aware of the colors. Need Red for cross
Need to solder keys and rp2040 together and program the chip. Code can be generated by AI.
Or if you want to use mine:
#include <Keyboard.h>
#include <Adafruit_NeoPixel.h>// ===== RGB =====
#define RGB_POWER 11
#define RGB_PIN 12
Adafruit_NeoPixel pixels(1, RGB_PIN, NEO_GRB + NEO_KHZ800);// ===== Physical buttons =====
// Left button triggers purple now
#define KEY_LEFT 4// Middle button triggers blue now
#define KEY_MIDDLE 2// Right button triggers red now
#define KEY_RIGHT 1bool lastLeft = HIGH;
bool lastMiddle = HIGH;
bool lastRight = HIGH;void setColor(uint8_t r, uint8_t g, uint8_t b) {
pixels.setPixelColor(0, pixels.Color(r, g, b));
pixels.show();
}void flash(uint8_t r, uint8_t g, uint8_t b) {
setColor(r, g, b);
delay(80);
setColor(0, 0, 30);
}void sendCtrlC() {
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press('c');
delay(50);
Keyboard.releaseAll();
}void sendCmdEnter() {
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press(KEY_RETURN);
delay(60);
Keyboard.releaseAll();
}void sendCmdShiftEnter() {
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.press(KEY_RETURN);
delay(70);
Keyboard.releaseAll();
}void setup() {
pinMode(KEY_LEFT, INPUT_PULLUP);
pinMode(KEY_MIDDLE, INPUT_PULLUP);
pinMode(KEY_RIGHT, INPUT_PULLUP);pinMode(RGB_POWER, OUTPUT);
digitalWrite(RGB_POWER, HIGH);pixels.begin();
setColor(0, 0, 30);delay(5000);
Keyboard.begin();setColor(0, 30, 0);
}void loop() {
bool sLeft = digitalRead(KEY_LEFT);
bool sMiddle = digitalRead(KEY_MIDDLE);
bool sRight = digitalRead(KEY_RIGHT);delay(10);
// Left button = Trust = Cmd + Shift + Enter
if (lastLeft == HIGH && sLeft == LOW) {
sendCmdShiftEnter();
flash(255, 0, 255); // purple
}// Middle button = Cmd + Enter
if (lastMiddle == HIGH && sMiddle == LOW) {
sendCmdEnter();
flash(0, 0, 255); // blue
}// Right button = Reject = Ctrl + C
if (lastRight == HIGH && sRight == LOW) {
sendCtrlC();
flash(255, 0, 0); // red
}lastLeft = sLeft;
lastMiddle = sMiddle;
lastRight = sRight;
}
License
You shall not share, sub-license, sell, rent, host, transfer, or distribute in any way the digital or 3D printed versions of this object, nor any other derivative work of this object in its digital or physical format (including - but not limited to - remixes of this object, and hosting on other digital platforms). The objects may not be used without permission in any way whatsoever in which you charge money, or collect fees.




Comment & Rating (0)