revk / ESP32-VL53L0X

VL53L0X (laser ranger) for ESP-IDF (e.g. ESp32)
GNU General Public License v3.0
18 stars 3 forks source link

Usage examples? #2

Open MoffKalast opened 4 years ago

MoffKalast commented 4 years ago

I know this is probably like totally abandoned, but I was wondering if there are any examples on how to use this thing at all.

So far the only thing I've managed to determine is that it does not follow the pololu library's setup. From what I can tell there is no type named VL53L0X, etc.

So in short, what would be the equivalent code for the original library's continuous example:

#include <Wire.h>
#include <VL53L0X.h>

VL53L0X sensor;

void setup(){
    Wire.begin();
    sensor.setTimeout(500);
    if (sensor.init()){
        sensor.startContinuous();
    }
}

void loop(){
    int x = sensor.readRangeContinuousMillimeters();
}

I've made some attempts to use the provided functions in a static way with no real luck, there's just too many parameters.

Another thing to note, if simply imported as a zip into Arduino IDE, this library isn't recognised. I've kind of managed to get it to work by stripping out the .c and .h and adding them to a new folder as a library which worked, but that still leaves me unable to actually do anything with it because the only documentation are 4 comment lines stating the obvious.

Thanks!

revk commented 4 years ago

Hi, the solarsystem code uses it so may be an example. It is not coded for the arduino ide, it is coded for the esp-idf, so C code on a Linux platform. So no idea if you can make it play ball.

MoffKalast commented 4 years ago

Hmm right. Though looking into this problem more (and into the pololu code), I'm not entirely sure what the main issue is with running the original arduino library on the ESP. After all it's supposedly possible to use Wire on ESP and the rest is just normal code, so it ought to be compatible...

So far I've managed to get it imported, compiled and uploaded, but it hangs at the sensor.init() of the above example. I don't suppose you have any insight as to what were the main issues that led you to write this library of yours?

revk commented 4 years ago

Main reason was to have some code I could easily use on the esp-idf, to be honest. I found loads of stuff for 8266 and aduino already.

na3eddin commented 8 months ago

hi @revk what is this solaris code you talked about, i really need the library you created asap. any help would be very apreciated

revk commented 8 months ago

solaris code? No idea

na3eddin commented 8 months ago

@revk you have mentioned the solarsystem code in your first comment, i need to see an example on how to use your library. do you have any available example?

revk commented 8 months ago

Ah you said solaris, sorry... Ok solar system is https://github.com/revk/SolarSystem but does not use VL53L0X?

na3eddin commented 8 months ago

@revk yes my bad thank you for the link i'll check that up