Does anybody want to share his code for the keyboard M5Stack?
-
I really would like to learn with them.
Thank you! -
Hi BitBoy01.
With this code, I was able to print the keyboard data on the LCD:#include <Arduino.h> #include <M5Stack.h> #define CARDKB_ADDR 0x5F void setup() { M5.begin(); Wire.begin(); // Lcd display init M5.Lcd.setBrightness(10); M5.Lcd.fillScreen(BLACK); M5.Lcd.setCursor(0, 0); M5.Lcd.setTextColor(WHITE); M5.Lcd.setTextSize(2); M5.Lcd.println("Grove Keyboard"); M5.Lcd.println("Version 0.1 10.09.2019"); M5.Lcd.printf("\n"); M5.Lcd.printf("IIC Address: 0x5F\n"); M5.Lcd.printf("\n"); } void loop() { Wire.requestFrom(CARDKB_ADDR, 1); while (Wire.available()) { char c = Wire.read(); // receive a byte as character if (c != 0) { if (c == 13) M5.Lcd.printf("\n"); // 13 is the new line code else M5.Lcd.printf("%c", c); // print as character } } }
Hope that helps...
-
Thank you! It is quite nice for the beginning.
-
There's some example code on the github here:
https://github.com/m5stack/M5Stack/blob/master/examples/Unit/CardKB/CardKB.ino
https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/CARDKB