sw=pyb.Switch()# create a switch objectsw.value()# get state (True if pressed, False otherwise)sw()# shorthand notation to get the switch statesw.callback(f)# register a callback to be called when the# switch is pressed downsw.callback(None)# remove the callback