猫史档案馆


【Python作品分享】microbit作品【作品秀】

用户:好奇和小石头好奇和小石头查看:0 回复:1 评论:0 创建时间:2022-07-06T20:00:39


【作品展示】

center_image

 

【作品介绍】

的功夫非

 

【作品源代码】

from microbit import *
import radio
import music
import elfshield


#When starting up
radio.reset()
compass.calibrate()
display.show([Image('00000:00000:00000:00000:00000'), Image.HAPPY, Image.CONFUSED, Image.ASLEEP], delay=100, wait=True, loop=False, clear=True)
display.show(Image.HAPPY)
display.scroll("Hello!I'm Microbit.")
radio.on()
radio.config(channel=6)
radio.send('Message')
while True:
    music.play(['c5:4'], pin=pin0, wait=True)
    motor.runSpeed(2,100)
    elfshield.dc130motor_speed(elfshield.PORT_A,500)

#When starting up
while True:
    if (elfshield.ultrasonic_getDistance(elfshield.PORT_A) < 20):
        motor.runSpeed(1,0)
    else:
        motor.runSpeed(1,200)

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
vtvtvtvtvvtvtvtvtv

家里有矿啊!micro.bit都配上了!

点赞0


评论