The Tilt Switch, like other switches, is used to control the flow of electricity to an I/O pad. However, this is a special type of switch as it needs to be tilted (hence the name) for it to be turned on/off.

To use the switch, you just need to connect one end to a power output (+) and then the other end to an input ( A, B, C or D).
Note: Don’t forget you will need to add batteries.

We use this block to monitor our chosen input. Whenever the button is pressed, current will be going through your chosen input e.g. B. You can change the options by clicking the letter or HI.

In this code, whenever B is HI (switch pressed down), the motor will run in forwards. When the switch isn’t pressed, the motor will stop – it will do this indefinitely.

Here is the tilt switch in action.