Switch¶

Description |
This switch locks into place when pressed. Switches are generally used to apply power or change a setting. |
Usage |
It reads LOW when locked into the pressed down position. It reads HIGH when locked into the pressed up position. |
Voltage Range |
0 - 5V |
Interface Type |
Digital Input |
Example Usage |
from microbit import *
while True:
switch_val = pin0.read_digital()
if switch_val == 0:
# switch is in DOWN position
# ...do something
else:
# switch is in UP position
# ...do something
|