cancel
Showing results for 
Search instead for 
Did you mean: 

INTERRUPT VL6180X

MSAMB.1
Associate III

Hello

I have advanced in my tests and in the realization of my product via the st APIs for the VL6180X, I need to carry out an interrupt during the detection of the target (my hand), I set my interrupt thresholds with sample_interrupt.c, however I want to run the LED with a Timer to indicate the interrupt time. Which file should be modified to achieve this? If you have any other information that might help me, we are interested. Thank you.

Regards,

Myveck

3 REPLIES 3
John E KVAM
ST Employee

I'm not exactly sure what your are asking, but I'll give it a shot.

In my code, I'm asleep at a point - waiting for interrupt.

This is a built-in function. There should be something similar in your code.

#define __WFI    __iar_builtin_WFI

When the interrupt comes in, read the distance data.

Then it's a matter of raising the GPIO pin attached to your LED.

On an STM32, you configure your GPIO, and you can raise and lower it at will.

Google "stm32 gpio tutorial" it will get you to some good information

If you want to use a timer to time the time between interrupts,

Google "STM32 HAL_GetTick()" it returns the number of milliseconds elapsed since startup.

So you can measure the time between calls.

  • john


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.
MSAMB.1
Associate III

Ok thank you John,

I translate from French to English that's why there is this concern.

I understood your explanation, I am using the sample interrupt function to create my user program. I would like to know how I can do to turn on the green LED of the Nucleo STM32 when the sensor detects the target and I want it to turn off when there is no target.

thank you so much

Hi @MSAMB.1​ ;

is your last question here above related to this thread?

If so, can you please check if Nizar's answer can be of any help for you?

Tks

-Eleon