PRG_micropython_microbit
READ_ANALOG
# ここにコードを書いてね :-) from microbit import * p0 = pin0.read_analog() print ( p0 )
その2
from microbit import *
# p0 = pin0.read_analog()
while 1 == 1 :
p0 = pin0.read_analog()
if p0 < 60 :
display.show(Image.HAPPY)
pin1.write_digital(0)
elif (60 < p0) and ( 90 > p0 ):
display.show( Image.ASLEEP)
elif (60 < p0) and (100 > p0) :
display.show(Image.ANGRY)
else :
display.show(Image.SAD)
pin1.write_digital(1)
# print ( p0 )