The Toggle Switch, similarly to other switches, is easy to use and simple to set up. The main difference between this and other switches is that, as the name suggests, you can toggle it on/off or closed/open; it will stay as one or the other. When used with the Crumble, you can trigger other events to occur when the switch is ‘toggled’.
To use the switch, you need to connect one end to a power output (+) and then the other end to an input on the Crumble (A, B, C or D). If the switch is on/closed, the input (A, B, C or D) will be HI. Whereas if it is off/open, the input (A, B, C or D) will be LO.
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 (switched on/closed), the motor will run forwards. If it is switched off (LO), the motor will stop. It will do this indefinitely.
Here is the code running on the Crumble.