猫史档案馆


【Python作品分享】microbit作品系统

用户:独立的玛洛斯qeVS独立的玛洛斯qeVS查看:0 回复:0 评论:0 创建时间:2022-07-22T22:08:35


【作品展示】

center_image

 

【作品介绍】

中国制造的第一个硬件与软件并用的操作系统。(^-^) 它使microbit这个硬件平台拥有了活力和整齐感。虽然这个

美好设想已经实现了,可还没经过

设备的调试,所以我还是没有停止。

愿本作品对你们有所帮助。(^-^)

(试用版,Golaxy0.33,hex0)

下一期,Golaxy0.45在这里等你!

版本列表:

1 Golaxy0.33

2 Golaxy0.45

3 Golaxy0.53

4 Golaxy0.61

5 Golaxy0.75

6 Golaxy0.84

7 Golaxy0.97

8 Golaxy1.07

9 Golaxy1.24

……

 

【作品源代码】

from microbit import *
import neopixel
import elfshield
import radio
import music


#When starting up
display.scroll('Hello.bit!')
display.scroll('Hi,136******38')
pin0.write_analog(0)
display.scroll('microbit is loading&')
LIGHT = neopixel.NeoPixel(pin8, 3)
LIGHT[-1] = (255,204,102)
if (temperature() > 40):
    sleep(10000)
display.show([Image.TARGET, Image('90990:90009:90090:90900:99999'), Image('99900:90900:99999:00909:00999')], delay=1000, wait=True, loop=False, clear=True)
display.show([Image('90909:09990:99099:09990:90909'), Image('09990:99999:00000:90909:09090'), Image('09990:90909:99999:90909:09990'), Image('02220:90909:99399:90909:01110'), Image('12221:11111:11111:11111:11111')], delay=10000, wait=False, loop=False, clear=False)
servo.angle(1,0)
root()
radio.on()
pin1.write_analog(0)
print('Hello')
return root0

def root(root0):

    if button_a.is_pressed():
        motor.runSpeed(1,50)
    if button_b.is_pressed():
        radio.off()
    if (button_a.get_presses() == 2):
        radio.config(channel=43)
        radio.send('')
    if (button_b.get_presses() == 2):
        music.play(['b0:1'], pin=pin0, wait=True)
        reset()
    if (button_a.get_presses() == 3):
        pin1.set_analog_period_microseconds(50)
        music.play(['b0:4'], pin=pin0, wait=True)
        sleep(elfshield.colorSensor_readRed(elfshield.PORT_A))
    if (button_b.get_presses() == 3):
        servo.angle(1,90)
        radio.reset()
        display.off()
        reset()


#microbitweeemake

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页