Skip to main content
Associate
January 31, 2024
Question

Interface VL53L0X with PIC18LF47K42 micro controller

  • January 31, 2024
  • 1 reply
  • 1919 views

Hi all,

I am trying to use a PIC18LF47K42 to read the distance from the Light Ranger 2 click board, which uses the sensor VL53L0X.

I copy two folders: core and platform, which are  inside the folder en.STSW-IMG005\VL53L0X_1.0.4\Api

I add these file into the project header files and source files 

In the main.c, I try to call only one function VL53L0X_DataInit(); same as below

void main(void) 

{

  VL53L0X_DataInit();

  while(1)

  {   

  } 

}

The problem is that I cannot compile. The MPLabX shows the below error:

./../../Year2/MGMT102/0-Datasheet/01-ST_VL6180/API/en.STSW-IMG005/VL53L0X_1.0.4/Api/core/src/vl53l0x_api_core.c:29:10: fatal error: 'vl53l0x_api.h' file not found

#include "vl53l0x_api.h"

     ^~~~~~~~~~~~~~~

1 error generated.

(908) exit status = 1

Could you please advise on a solution to the issue?

Thanks,

This topic has been closed for replies.

1 reply

Andrew Neil
Super User
January 31, 2024

So it's telling you that it can't find the file  'vl53l0x_api.h

Do you actually have that file anywhere on your system?

 

Use this button to properly post source code:

AndrewNeil_0-1706721508509.png

 

To get that extra row of icons, press this button:

AndrewNeil_1-1706721508505.png

 

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
DuyHoangAuthor
Associate
January 31, 2024

Hi Andrew,

I have that file in the folder core\inc, and I have added it to the header files of my project.

Andrew Neil
Super User
January 31, 2024

The message says that the compiler can't find it.

As the file does exist, then the problem must be in your Include Paths - ie, you are not directing the compiler to look in the correct place.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.