Hello everybody!
I am new to the forum and a newbie to the Teensy world in general, so sorry if I am not too precise or if I say something obvious. I am currently trying to read the measurements of a VL53L0X sensor on a Flow Deck expansion by Bitcraze by the means of a Teensy 3.2. I have no problem with the optic flow sensor, but whenever I try to use the VL53L0X I can't even initialize it. I was originally using the Wire.h library, but I have then discovered it is not compatible with Teensy 3.2. I tried to use the i2c_t3 library (which should be compatible), but now every time I launch my code my pc freezes.
To test if it wasn't a wiring problem, I have also tried to do the exact same thing with an Arduino Mega 2560 using the Wire.h library and it works perfectly. So I am pretty sure it is a library problem... Maybe the i2c_t3 isn't what I am searching for or I am using it wrong. Do you guys have any suggestions?
This is my code:
#include <i2c_t3.h>
//#include <Wire.h>
#include <VL53L0X.h>
VL53L0X sensor;
void setup()
{
Serial.begin(9600);
Wire.begin();
Serial.print("B");
sensor.setTimeout(500);
sensor.setTimeout(500);
if (!sensor.init())
{
Serial.println("Failed to detect and initialize sensor!");
while (1) {}
}
Serial.print("C");
// Start continuous back-to-back mode (take readings as
// fast as possible). To use continuous timed mode
// instead, provide a desired inter-measurement period in
// ms (e.g. sensor.startContinuous(100)).
sensor.startContinuous();
}
int incomingByte = 0;
boolean stop = true;
void loop()
{
if(stop == true){
Serial.print(sensor.readRangeContinuousMillimeters());
if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }
Serial.println();
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
if(incomingByte == 'k'){
stop = false;
Serial.print("Program stopped.");
}
}
}
}
I am new to the forum and a newbie to the Teensy world in general, so sorry if I am not too precise or if I say something obvious. I am currently trying to read the measurements of a VL53L0X sensor on a Flow Deck expansion by Bitcraze by the means of a Teensy 3.2. I have no problem with the optic flow sensor, but whenever I try to use the VL53L0X I can't even initialize it. I was originally using the Wire.h library, but I have then discovered it is not compatible with Teensy 3.2. I tried to use the i2c_t3 library (which should be compatible), but now every time I launch my code my pc freezes.
To test if it wasn't a wiring problem, I have also tried to do the exact same thing with an Arduino Mega 2560 using the Wire.h library and it works perfectly. So I am pretty sure it is a library problem... Maybe the i2c_t3 isn't what I am searching for or I am using it wrong. Do you guys have any suggestions?
This is my code:
#include <i2c_t3.h>
//#include <Wire.h>
#include <VL53L0X.h>
VL53L0X sensor;
void setup()
{
Serial.begin(9600);
Wire.begin();
Serial.print("B");
sensor.setTimeout(500);
sensor.setTimeout(500);
if (!sensor.init())
{
Serial.println("Failed to detect and initialize sensor!");
while (1) {}
}
Serial.print("C");
// Start continuous back-to-back mode (take readings as
// fast as possible). To use continuous timed mode
// instead, provide a desired inter-measurement period in
// ms (e.g. sensor.startContinuous(100)).
sensor.startContinuous();
}
int incomingByte = 0;
boolean stop = true;
void loop()
{
if(stop == true){
Serial.print(sensor.readRangeContinuousMillimeters());
if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }
Serial.println();
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
if(incomingByte == 'k'){
stop = false;
Serial.print("Program stopped.");
}
}
}
}