Microswitch¶

Description |
The microswitch is used in a wide variety of applications. Operationally, it is nothing more than a button. It can be used as a crash sensor to detect robot touch. |
Usage |
It is digital which means it reads either HIGH or LOW. This device reads HIGH by default and LOW when pressed. |
Voltage Range |
0 - 5V |
Interface Type |
Digital Input |
Example Usage |
from microbit import *
while True:
micro_val = pin0.read_digital()
if micro_val == 0:
# microswitch is pressed
# ...do something
else:
# microswitch is NOT pressed
# ...do something
|