M5Stick and VL53L1X



  • Hi all,

    I'm trying VL53L1X sensor on M5Stick through grove connection

    VL53L1X---------------------M5Stick
    VIN-------------------------------5v grove
    GRD-------------------------------grd grove
    SDA--------------------------------G21 grove
    SCL---------------------------------G22 grove

    uploading this sketch

    /*
      This example shows how to take simple range measurements with the VL53L1X. The
      range readings are in units of mm.
    */
    
    #include <Wire.h>
    #include <VL53L1X.h>
    
    VL53L1X sensor;
    
    void setup()
    {
    
      Serial.begin(115200);
      Wire.begin();
      Wire.setClock(400000); // use 400 kHz I2C
    
      sensor.setTimeout(500);
      if (!sensor.init())
      {
        Serial.println("Failed to detect and initialize sensor!");
        while (1);
      }
    
      // Use long distance mode and allow up to 50000 us (50 ms) for a measurement.
      // You can change these settings to adjust the performance of the sensor, but
      // the minimum timing budget is 20 ms for short distance mode and 33 ms for
      // medium and long distance modes. See the VL53L1X datasheet for more
      // information on range and timing limits.
      sensor.setDistanceMode(VL53L1X::Long);
      sensor.setMeasurementTimingBudget(50000);
    
      // Start continuous readings at a rate of one measurement every 50 ms (the
      // inter-measurement period). This period should be at least as long as the
      // timing budget.
      sensor.startContinuous(50);
    }
    
    void loop()
    {
      Serial.print(sensor.read());
      if (sensor.timeoutOccurred()) {
        Serial.print(" TIMEOUT");
      }
    
      Serial.println();
    }
    

    this is the serial monitor output...

    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff0018,len:4
    load:0x3fff001c,len:1100
    load:0x40078000,len:9220
    load:0x40080400,len:6300
    entry 0x400806a4
    Failed to detect and initialize sensor!
    
    

    whats wrong??



  • M5Stick GROVE Interface SCL: GPIO13, SDA: GPIO25. Look at M5Stick doc


  • M5Stack

    Yes, The grove pins on M5Stick are difference with M5Core.
    0_1552530776691_微信截图_20190314103152.png


Log in to reply
 

Looks like your connection to M5Stack Community was lost, please wait while we try to reconnect.