Template: Tilt Sensor STM32 Guide
From Waveshare Wiki
The STM32 examples are based on the STM32F103RBT6 and the STM32H743. The connection provided below is based on the STM32F103RB. If you need to use other STM32 boards, you may need to change the hardware connection and port the code yourself.
STM32
Hardware Connection
Sensor | STM32 | Description |
---|---|---|
VCC | 3.3V | Power input |
GND | GND | Power ground |
DOUT | PA4 | Digital output |
Examples
The demo is developed based on the HAL library. Please download the program inside the material, find the STM32 program file directory, open the Tilt-Sensor-code\STM32\STM32F103RB\MDK-ARM directory of Tilt Sensor.uvprojx, and you can see the program.
Open main.c and recompile to download.
- After downloading, run SSCOM to connect the Tilt module, and you can see the sensor status.
When shake or tilt the module, the signal indicator on the module is on. When placing the module, the signal indicator on the module is off.