Tilt Switch¶
Overview¶
In this lesson, you will learn about tilt switch. Tilt switch can be used to detect whether objects tilt, which is of great value in practical applications. It can be used to judge the tilt of bridges, buildings, transmission line tower and so on, so it has an important guiding function in carrying out maintenance work.
Required Components¶
In this project, we need the following components.
It’s definitely convenient to buy a whole kit, here’s the link:
Name |
ITEMS IN THIS KIT |
LINK |
---|---|---|
Elite Explorer Kit |
300+ |
You can also buy them separately from the links below.
COMPONENT INTRODUCTION |
PURCHASE LINK |
---|---|
- |
|
- |
Fritzing Circuit¶
In this example, digital pin 2 is used to read the signal of Tilt Switch.
Schematic Diagram¶
Code¶
Note
You can open the file
04-tilt_switch.ino
under the path ofelite-explorer-kit-main\basic_project\04-tilt_switch
directly.Or copy this code into Arduino IDE.
Once the codes are uploaded to the uno r4 board, you can open the serial monitor to view the pin readings. The readings will display either “1” or “0” depending on whether the Tilt Switch is in a vertical position (with the internal metal ball making contact with the Wire Pins) or tilted.