Collision limit detection module: external interrupt control LED

Hardware wiring

1

Collision limit detection moduleSTM32F103RCT6
VCC5V/3.3V
OUTPA1
NC 
GNDGND

Brief principle

Circuit schematic

2

The LED is connected to the PB4 pin, you need to pay attention to the pin configuration of PB4 (see the code for the specific configuration):

PB4 output high level, LED on;

The PB4 output is low and the LED is off.

When a collision occurs in the collision detection module, OUT outputs a high level When PA1 generates a rising edge signal, the program enters an external interrupt and the LED is lit.

Main code

main.c

LED.c

LED.h

EXTI.c

EXTI.h

Phenomenon

After downloading the program, press the Reset key once, and the downloaded program will run.

When the collision detection module detects a collision, the LED is lit. If you need to restore the detection mode again, you need to press the Reset button on the board or power off once, and the LED will turn off.