Lab: I2C Communication with a Time-of-Flight Distance Sensor

#include <Adafruit_VL53L0X.h>

Adafruit_VL53L0X sensor = Adafruit_VL53L0X();

const int maxDistance  = 2000;
 
void setup() {
  // initialize serial, wait 3 seconds for
  // Serial Monitor to open:
  Serial.begin(9600);
  if (!Serial) delay(3000);
 
  // initialize sensor, stop if it fails:
  if (!sensor.begin()) {
    Serial.println("Sensor not responding. Check wiring.");
    while (true);
  }

  sensor.configSensor(Adafruit_VL53L0X::VL53L0X_SENSE_LONG_RANGE);
  // set sensor to range continuously:
  sensor.startRangeContinuous();
}

void loop() {
  // if the reading is done:
  if (sensor.isRangeComplete()) {
    // read the result:
    int result = sensor.readRangeResult();
    // if it's with the max distance:
    if (result < maxDistance) {
      // print the result (distance in mm):
      Serial.println(result);
 
    }
  }
}

E3D9BF41-FBCD-44C7-97D4-7CB19310F1DD.jpeg

FullSizeRender.MOV

Measuring distance between screen & breadboard


Changes to interaction:

Tambourine

Traditional Chinese Tambourine

Traditional Chinese Tambourine

Lion

Lion

Lion

  1. Boost up speed
  2. Extra lives
  3. Lion will Gain larger?!~~