Raspberry Pi Pico
Tilt Switch

In its simplest form, the tilt sensor can tell you whether or not you are tilting the sensor along a single axis. The general principle is to have a metal ball that moves when the sensor is tilted, making or breaking a circuit, much as pressing a button completes or breaks a circuit. Older sensors used mercury - sensors you use should state that they are free of mercury. The sensor on this page are of an on/off nature. You're not getting any measure of how much the sensor is tilted, just that it is.

This was my setup,

Pico Circuit

You might be able to see thing a little more clearly in this Fritzing diagram,

Pico Circuit

The program,

from machine import Pin
from time import sleep

tilt = Pin(15, Pin.IN, Pin.PULL_UP)

led = Pin(25, Pin.OUT)

while True:
    led.value(tilt.value())
    sleep(1)

Note that, with the pull up resistor, the tilt switch remains low (closed) until it is tilted. At this point, it returns a high and the LED goes on.