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

    Dices example not working on M5Stick C

    M5 Stick/StickC
    6
    8
    12.7k
    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.
    • L
      Leo05
      last edited by Leo05

      M5StickC - It compile without error, but nothing happens when shaking. Any suggestion?

      1 Reply Last reply Reply Quote 0
      • T
        Thrasher
        last edited by

        Id start trying to make simple code with label and displaying imu data on it, to see if imu works

        1 Reply Last reply Reply Quote 0
        • S
          Stormproof
          last edited by

          You have to change IMU type in code.Sample is for previous type.Now it is MPU...

          1 Reply Last reply Reply Quote 0
          • S
            Stormproof
            last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • S
              Stormproof
              last edited by

              @stormproof said in Dices example not working on M5Stick C:

              A

              /*

              A couple of dices on a tiny 80x160px TFT display

              Author: Alfonso de Cala alfonso@el-magnifico.org

              */

              #include <M5StickC.h>

              #define DOT_SIZE 6
              int dot[6][6][2] {
              {{35,35}},
              {{15,15},{55,55}},
              {{15,15},{35,35},{55,55}},
              {{15,15},{15,55},{55,15},{55,55}},
              {{15,15},{15,55},{35,35},{55,15},{55,55}},
              {{15,15},{15,35},{15,55},{55,15},{55,35},{55,55}},
              };

              int16_t accX = 0;
              int16_t accY = 0;
              int16_t accZ = 0;

              void setup(void) {
              M5.begin();
              M5.MPU6886.Init();

              M5.Lcd.setRotation(1);

              M5.Lcd.fillScreen(TFT_GREEN);

              M5.Lcd.setTextColor(TFT_BLACK); // Adding a background colour erases previous text automatically

              M5.Lcd.setCursor(10, 30);
              M5.Lcd.setTextSize(3);
              M5.Lcd.print("SHAKE ME");
              delay(1000);
              }

              void loop() {

              while(1) {
              M5.MPU6886.getAccelAdc(&accX,&accY,&accZ);
              if (((float) accX) * M5.MPU6886.aRes > 1 || ((float) accY) * M5.MPU6886.aRes > 1 ) {
              break;
              }
              }

              M5.Lcd.fillScreen(TFT_GREEN);

              // Draw first dice
              delay(1000); // A little delay to increase suspense :-D
              int number = random(0, 6);
              draw_dice(5,5,number);

              // Draw second dice
              delay(1000);
              number = random(0, 6);
              draw_dice(85,5,number);

              }

              void draw_dice(int16_t x, int16_t y, int n) {

              M5.Lcd.fillRect(x, y, 70, 70, WHITE);

              for(int d = 0; d < 7; d++) {
              if (dot[n][d][0] > 0) {
              M5.Lcd.fillCircle(x+dot[n][d][0], y+dot[n][d][1], DOT_SIZE, TFT_BLACK);
              }
              }

              }

              1 Reply Last reply Reply Quote 0
              • F
                frogman
                last edited by

                I'm having a similar problem, except that I'm definitely using the MPU6886 code. There are two files in the examples, almost identical, except for the IMU code. I chose the MPU6886 version, and it never detects any movement. I've also tried the IMU sample, and that sample doesn't show any change - all values are always zero.

                1 Reply Last reply Reply Quote 0
                • N
                  noiseislife
                  last edited by

                  To get around this I saved the Example sketch to disk, deleted the file Dices.ino and then opened Dices_MPU6886.iso. You will get a message about requiring that the directory name be changed, which it does for you.

                  You should now be able to successfully compile the sketch to the m5stick.

                  I 1 Reply Last reply Reply Quote 1
                  • I
                    ilex73 @noiseislife
                    last edited by

                    @noiseislife said in Dices example not working on M5Stick C:

                    To get around this I saved the Example sketch to disk, deleted the file Dices.ino and then opened Dices_MPU6886.iso. You will get a message about requiring that the directory name be changed, which it does for you.

                    You should now be able to successfully compile the sketch to the m5stick.

                    Thank you. Now it works !

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