Skip to content
Snippets Groups Projects
Commit 26b3c6f7 authored by Aaron John Sabu's avatar Aaron John Sabu
Browse files

Added LIDAR Code

parent 1aef4a0d
No related merge requests found
/* Wiring:
3v3 on ESP32 goes to VCC on CMJU-531
GND on ESP32 goes to GND on CMJU-531
D21 (GPIO21, I2C SDA) on ESP32 goes to SDA on CMJU-531
D22 (GPIO22, I2C SCL) on ESP32 goes to SCL on CMJU-531
*/
#include <Wire.h>
#include <SparkFun_VL53L1X.h> // https://github.com/sparkfun/SparkFun_VL53L1X_Arduino_Library/
SFEVL53L1X distanceSensor;
int budgetIndex = 4;
int budgetValue[7] = {15, 20, 33, 50, 100, 200, 500};
int LED = LED_BUILTIN;
void setup() {
Serial.begin(115200);
pinMode(LED, OUTPUT);
digitalWrite(LED, HIGH);
Wire.begin();
delay(250);
if (distanceSensor.begin() == 0)
Serial.println("Sensor online!");
distanceSensor.startRanging();
distanceSensor.setIntermeasurementPeriod(budgetValue[3]);
digitalWrite(LED, LOW);
}
void loop() {
Serial.println(distanceSensor.getDistance());
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment