Hi Robin,
Thank you for your kind reply. Here it is the link to the complete documentation regarding the VL6180X module. In particular, I focused my study on the general datasheet: https://www.st.com/resource/en/datasheet/vl6180x.pdf and the technical notes about the range measurement: https://www.st.com/content/ccc/resource/technical/document/application_note/d5/bb/ec/94/7d/1e/40/a0/DM00122600.pdf/files/DM00122600.pdf/jcr:content/translations/en.DM00122600.pdf
This is the main code I am currently using:
var sensor1; var I2C1 = new I2C();
function onTimer() { var l1 = sensor1.readRange(); console.log("Sensor 1: "+ l1 +" mm"); }
function initHW(){ digitalWrite(D31, 0); I2C1.setup({sda:D1, scl:D2, bitrate:400000}); }
function initSensor(){ console.log('Initialazing sensor'); digitalWrite(D31, 1); sensor1 = require("https://github.com/SalvoCas/EspruinoDocs/blob/master/devices/VL6180X.js").connect(I2C1, {address:0x29}); }
function doStart(){ initHW(); initSensor(); setTimeout(function() {}, 1); var status = sensor1.readRangeStatus(); if(status == 0){
setInterval(onTimer, 500);
} else{
console.log('Error number: '+ status);
} }
doStart();
The error I am encountering is a overflow error, specified by the RangeStatus number 15. The espruino board I am using has the latest version on it.
Thank you for the help!
@user109290 started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi Robin,
Thank you for your kind reply. Here it is the link to the complete documentation regarding the VL6180X module. In particular, I focused my study on the general datasheet:
https://www.st.com/resource/en/datasheet/vl6180x.pdf
and the technical notes about the range measurement: https://www.st.com/content/ccc/resource/technical/document/application_note/d5/bb/ec/94/7d/1e/40/a0/DM00122600.pdf/files/DM00122600.pdf/jcr:content/translations/en.DM00122600.pdf
This is the main code I am currently using:
var sensor1;
var I2C1 = new I2C();
function onTimer() {
var l1 = sensor1.readRange();
console.log("Sensor 1: "+ l1 +" mm");
}
function initHW(){
digitalWrite(D31, 0);
I2C1.setup({sda:D1, scl:D2, bitrate:400000});
}
function initSensor(){
console.log('Initialazing sensor');
digitalWrite(D31, 1);
sensor1 = require("https://github.com/SalvoCas/EspruinoDocs/blob/master/devices/VL6180X.js").connect(I2C1, {address:0x29});
}
function doStart(){
initHW();
initSensor();
setTimeout(function() {}, 1);
var status = sensor1.readRangeStatus();
if(status == 0){
}
else{
}
}
doStart();
The error I am encountering is a overflow error, specified by the RangeStatus number 15.
The espruino board I am using has the latest version on it.
Thank you for the help!