CardKB Mini Keyboard Unit (MEGA328P)
Description
CardKB is a unit can implement a full-featured QWERTY keyboard. Consider that you want make some cool stuff that require keyboard typing and interaction, but M5 core it self just have 3 buttons, here comes the flexible and powerful CardKB unit.
It also can achieve button combination(Sym+Key, Shift+Key, Fn+Key) and output richer key value. This unit communicates with M5Core through GROVE A port(IIC interface). Address is 0x5F.
Product Features
- Full-function keyboard, multi-key combination
- Program Platform: Arduino, UIFlow(Blockly, Python)
Kit includes
- 1x CardKB unit
- 1x GROVE Cable
Application
- Keyboard peripherals for M5Stack Core
Documents
Learn
Example
1. Arduino IDE
To get the code, please click here。
#include <Wire.h> #include <M5Stack.h> #define CARDKB_ADDR 0x5F void setup() { M5.begin(); Serial.begin(115200); Wire.begin(); pinMode(5, INPUT); digitalWrite(5, HIGH); M5.Lcd.fillScreen(BLACK); M5.Lcd.setCursor(1, 10); M5.Lcd.setTextColor(YELLOW); M5.Lcd.setTextSize(2); M5.Lcd.printf("IIC Address: 0x5F\n"); M5.Lcd.printf(">>"); } void loop() { Wire.requestFrom(CARDKB_ADDR, 1); while (Wire.available()) { char c = Wire.read(); // receive a byte as characterif if (c != 0) { M5.Lcd.printf("%c", c); Serial.println(c, HEX); // M5.Speaker.beep(); } } }
2. UIFlow
To get the complete code, please click here。
More information
1. Button combination description:
-
Single button pressed, keyborad will output the first key value(letter button will output lower case form). E.g if "Q" was pressed, keyboard will output "q"(lower case).
-
Sym+key, keyborad will output the second key value. E.g if "Sym" was single pressed, then "Q" was pressed, the keyboard will output "{". If "Sym" was double clicked, then the keyboard will lock this function, all key pressed will output it's second key value.
-
Shift+key, if a letter button was pressed, it'll output upper case form. E.g if "Shift" was single pressed, then "Q" was pressed, the keyboard will output "Q". If "Shift" was double clicked, then the keyboard will lock this function, all letter key pressed will output it's upper case form.
-
Fn+key(custom function key combination), keyborad will output the third key value. You can custom what function the key pressed corresponds.
PinMap
M5Core(GROVE A) GPIO22 GPIO21 5V GND CardKB SCL SDA 5V GNDThe CardKB Mini Keyboard Unit (MEGA328P) appears in the following collections: