cancel
Showing results for 
Search instead for 
Did you mean: 

Two leds based on one interrupt line

Manoj Hiwarkar
Associate III

Dear sir,

I am using STM32F769NI microcontroller. I want to glow to different Leds on one external interrupt line i.e. Led1 on rising edge and Led2 on falling edge. Can you please suggest me the solution.

Regards,

Manoj

This discussion is locked. Please start a new topic to ask your question.
7 REPLIES 7

You can set interrupt on both edges in EXTI, and by reading the current state of pin from GPIO_IDR you can determine which was the last edge.

JW

Ok. But in my case the level 0 appears in two cases first when logic 0 is applied and second when the line is disconnected. So what shall I do in this situation?

What is "line disconnected"? Elaborate.

JW

Manoj Hiwarkar
Associate III

@Community member​  line disconnected means open.

LCE
Principal II

Use a pull-up resistor.

Manoj Hiwarkar
Associate III

So the last state will be always '1' if I use the pull up resistor.

There is no magic way to distinguish 3 states.

In software, periodically switch between pullup and pulldown, and sample input. If input follows the pullup/pulldown pattern, it's open; otherwise it's connected and you know its polarity.

JW