Code: Select all
MicroPython v1.9.2-34-gd64154c73 on 2017-09-01; micro:bit v1.0.1 with nRF51822
Type "help()" for more information.
>>>
>>> from microbit import *
>>> pin2.get_mode()
'read_digital'
>>> pin2.write_digital(1)
>>> pin2.get_mode()
'write_digital'
>>> pin2.write_analog(123)
>>> pin2.get_mode()
'write_analog'
>>> pin2.is_touched()
False
>>> pin2.get_mode()
'touch'
>>> pin2.read_analog()
223
>>> pin2.get_mode()
'unused'
Code: Select all
>>> pin2.write_analog(123)
>>> pin2.get_mode()
'write_analog'
>>> pin2.write_analog(0)
>>> pin2.get_mode()
'unused'