制作坊microbit指北针 专区

microbit指北针

吴文睿2020-04-10 361人围观
Python代码:
input.calibrate_compass()
def on_forever():
if 60 >= input.compass_heading() or input.compass_heading() > 330:
basic.show_arrow(ArrowNames.NORTH)
if input.compass_heading() >= 269 and input.compass_heading() < 330:
basic.show_arrow(ArrowNames.EAST)
if input.compass_heading() >= 61 and 169 >= input.compass_heading():
basic.show_arrow(ArrowNames.WEST)
if input.compass_heading() >= 170 and 270 >= input.compass_heading():
basic.show_arrow(ArrowNames.SOUTH)
basic.forever(on_forever)
2 +1

评论

有用哎

#1 2020-04-17 15:07 0 回复