ディジタル入力 / read_digital()

参考: Programming the BBC micro:bit: Getting Started with MicroPython, p.115
 

from microbit import *

while True:
    if pin0.read_digital():
        display.show("H")
    else:
        display.show("L")


 
―――――――――――――――――――――――――――――――
オンボードボタンの接続は下のようになっている。設計データが公開されている
f:id:ti-nspire:20171227132255p:plain:w400