🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Does anybody want to share his code for the keyboard M5Stack?

    FACES Kit
    3
    4
    8.3k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      BitBoy01
      last edited by

      I really would like to learn with them.
      Thank you!

      1 Reply Last reply Reply Quote 0
      • hagueH
        hague
        last edited by

        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...

        1 Reply Last reply Reply Quote 0
        • B
          BitBoy01
          last edited by

          Thank you! It is quite nice for the beginning.

          1 Reply Last reply Reply Quote 0
          • lukasmaximusL
            lukasmaximus
            last edited by

            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

            1 Reply Last reply Reply Quote 0
            • First post
              Last post