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

    M5stickC and VL53L1X sensor GROVE port

    M5 Stick/StickC
    3
    4
    7.8k
    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.
    • C
      cepics
      last edited by

      Hi, is it possible to connect VL53L1X sensor to M5StickC on GROVE port?
      I dont know how to set sda and scl pins of the GROVE... maybe with Wire1 ??
      I'm using arduino IDE
      this code doesn't work..

      #include <M5StickC.h>
      #include <Wire.h>
      #include <VL53L1X.h>
      VL53L1X sensor;
      
      
      float accX = 0;
      float accY = 0;
      float accZ = 0;
      
      int cm;
      int feet;
      int inches;
      int INCHES;
      bool unit = 0;
      
      #define TFT_GREY 0x5AEB // New colour
      
      void setup() {
      
        M5.begin();
      
        Wire.begin();
        Wire.begin(32, 33); // (SDA, SCL) grove stickC
        Wire.setClock(400000); // use 400 kHz I2C
      
        M5.Lcd.setRotation(3);
        M5.MPU6886.Init();
      
        sensor.setDistanceMode(VL53L1X::Long);
        sensor.setMeasurementTimingBudget(50000);
        sensor.startContinuous(50);
      
      }
      
      void loop() {
        M5.MPU6886.getAccelData(&accX, &accY, &accZ);
      
        if (accX < 0) {
          M5.Lcd.setRotation(3);
        } else {
          M5.Lcd.setRotation(1);
        }
      
          cm = (sensor.read() / 10); //CM
          inches = cm / 2, 54;
          feet = inches / 12;
          INCHES = inches % 12; //es x = 7% 5; // X ora contiene 2
      
      
        M5.Lcd.fillScreen(TFT_GREY);
        M5.Lcd.setCursor(10, 16);
        M5.Lcd.setTextColor(TFT_YELLOW);
        M5.Lcd.setTextFont(7);
        //M5.Lcd.println(12.10);
        M5.Lcd.println(cm);
        delay(100);
      }
      

      tnks a lot

      1 Reply Last reply Reply Quote 0
      • C
        cepics
        last edited by

        nobody?

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

          Have you tried this code sample yet?
          https://github.com/m5stack/M5-ProductExampleCodes/blob/master/Unit/TOF/Arduino/TOF_VL53L0X/TOF_VL53L0X.ino

          BTW there is a new TOF Hat for the stick C

          https://m5stack.com/collections/all/products/m5stickc-tof-hatvl53l0x

          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
          • W
            wikistik
            last edited by

            @cepics said in M5stickC and VL53L1X sensor GROVE port:

            VL53L1X

            I tried the VL53L0X unit on the grove port of the stick several times and could not get it to work. I know that really doesn't really help you but at least your are not alone in this quest :)

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