cancel
Showing results for 
Search instead for 
Did you mean: 

Dear All, Can I use VL53L0X API with arduino UNO BOARD?

OAran.351
Associate
 
4 REPLIES 4
John E KVAM
ST Employee

The official company line is "use an STM32", but to be clear - you do NOT have to.

All the VL53L0x API calls that you make end up in a relatively few I2C read and write functions.

But we don't know which processor you are using so we created a platform.c file - that is mostly empty.

It has the functions for read_byte, write_byte, read_word, write_word, read_longword and write_longword.

But the functions are empty.

Your job is to populate the functions so they work for your processor.

It's really pretty easy as most processors contain enough examples you should be able to find some code.

But be a little careful, the 'endiness' is critical. So a byte or word swap may be required based on your CPU.

Once you populate the I2C functions, and figure out if you need an 'Open' or I2C_init function, you should be fine.

So:

Step 1, find the platform.c file.

Step 2, populate the functions within that file.

Step 3, Test to insure you are not accidentally swapping the bytes - or not swapping them. See the verification app note to show you how to do this.

And you should be fine.

Just compile and run.


If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.

Thank you John for the detailed answer. However, I am afraid that I still feel quite lost after reading your post. I think you are assuming that I have some prior knowledge about the thing, but honestly I am quite an unexperienced user and quite new with Arduino as well. Do you find it possible to get a good reference to a link, documentation, etc. that provides a good step by step guidance through the process of implementing an API in Arduino?

Actually what I am really interested in is carrying out the different calibrations and setting up the low power comsuption mode to the VL53L0X distance sensor. Perhaps it is not necessary to consider the API at all. I do not know... I would really appreciate if you can bring me some light around all this.

Thank you!

GPodr.1
Associate II
FPayn.1
Associate III

I too am just a newbie with respect to the VL53L0X, but I have a post on my blog site that might help. See https://www.fpaynter.com/2020/06/replacing-hc-sro4-ultrasonic-sensors-with-vl53l0x-arrays/

Frank