Skip to main content
Visitor II
September 1, 2020
Question

INTERRUPT VL6180X

  • September 1, 2020
  • 2 replies
  • 898 views

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

    This topic has been closed for replies.

    2 replies

    ST Employee
    September 3, 2020

    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

    MSAMB.1Author
    Visitor II
    September 3, 2020

    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

    ST Employee
    September 11, 2020

    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