This is a ball tilt-switch with a metal ball inside. It is used to detect inclinations of a small angle.
The tilt switch has an iron ball inside, when you put it upright, the iron ball falls down, which can make the 2 pins connected together; tilt it to a horizontal angle, the iron ball rolls towards the end, so the 2 pins of the tilt switch are disconnected.
Again, you need to connect 10K pull-up resistor to get a stable level.
After connecting Pico, click the Start button and the code starts to run. When the tilt switch is placed horizontally, the LED will turn on; and when placed vertically, the LED will turn off.
This project code is exactly the same as the previous project Button.