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

    Core2 keeps crashing when I try to connect a CardKB module using Arduino IDE

    Arduino
    4
    4
    531
    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.
    • A
      avmg2502
      last edited by

      Hello, i am having trouble uploading a code to Core2, trying to connect a CardKB module.
      Does anyone know how to fix it?

      #include "Wire.h"
      #include "Arduino.h"
      #include "M5GFX.h"
      #include "M5Unified.h"
      #define CARDKB_ADDR 0x5F
      
      int x=10,y=10;
      
      M5GFX display;
      M5Canvas canvas(&display);
      
      void setup()
      {
       auto cfg = M5.config();
       M5.begin(cfg);
       Serial.begin(115200);
       Wire.begin();
       pinMode(5, INPUT);
       digitalWrite(5, HIGH);
       M5.Lcd.fillScreen(YELLOW);
       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)
       {
        if(c==180){
          //M5.clear();
          //x=x-10;
          M5.Lcd.fillCircle(50, 50, 22, TFT_RED);
        }
        if(c==181){
          //M5.Display.clear();
          y=y-10;
          M5.Lcd.fillCircle(100, 50, 22, TFT_BLUE);
        }
        if(c==182){
          //M5.Display.clear();
          y=y+10;
          M5.Lcd.fillCircle(50, 100 , 22, TFT_YELLOW);
        }
        if(c==183){
          M5.Display.setCursor(0,0);
          //M5.Lcd.fillScreen(WHITE);
          delay(1000);
          M5.update();
          x=x+10;
          M5.Lcd.fillCircle(100, 100, 22, TFT_GREEN);
        }
       //M5.Lcd.printf("%c", c);
       //Serial.println(c, HEX);
       // M5.Speaker.beep();
       }
       }
      }
      
      kurikoK ajb2k3A 2 Replies Last reply Reply Quote 0
      • kurikoK
        kuriko @avmg2502
        last edited by

        @avmg2502
        You should debug line by line to see which operation caused it.

        Good morning, and welcome to the Black Mesa Transit System.

        felmueF 1 Reply Last reply Reply Quote 1
        • felmueF
          felmue @kuriko
          last edited by

          Hello @kuriko

          just curious - why are your setting GPIO5 to input? This disables the display - is that what you intended?

          Thanks
          Felix

          GPIO translation table M5Stack / M5Core2
          Information about various M5Stack products.
          Code examples

          1 Reply Last reply Reply Quote 0
          • ajb2k3A
            ajb2k3 @avmg2502
            last edited by

            @avmg2502 How is it crashing?
            What is the error message?

            UIFlow, so easy an adult can learn it!
            If I don't know it, be patient!
            I've ether not learned it or am too drunk to remember it!
            Author of the WIP UIFlow Handbook!
            M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

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