猫史档案馆


【Python作品分享】microbit作品【作业帖】

用户:实干的扎古AudQ实干的扎古AudQ查看:0 回复:0 评论:0 创建时间:2020-02-27T18:30:07


【作品展示】

center_image

 

【作品介绍】

vfvfvf vfv

 

【作品源代码】

from microbit import *
import radio
import elfshield
import neopixel


#When starting up
while True:
    # 001
    radio.on()
    radio.config(channel=6)
    radio.send(' hello Message')
    display.scroll(radio.receive())
    radio.reset()
    radio.off()
    display.on()
    display.show(Image('09090:99999:09990:00900:88888'))
    compass.calibrate()
    if compass.is_calibrated():
        if (compass.get_field_strength() == 2):
            display.show(Image('11111:10001:10999:10001:11111'))
    if (accelerometer.get_gestures() == accelerometer.is_gesture('9g')):
        display.scroll('e30')
    while True:
        radio.on()
        radio.config(channel=6)
        radio.send(' hello Message')
        display.scroll(radio.receive())
        radio.reset()
        radio.off()
        display.on()
        display.show(Image('09090:99999:09990:00900:88888'))
        compass.calibrate()
        if compass.is_calibrated():
            if (compass.get_field_strength() == 1):
                display.show(Image('11911:10901:10901:10001:11111'))
        if (accelerometer.get_gestures() == accelerometer.is_gesture('9g')):
            display.scroll('e30')
            elfshield.dc130motor_speed(elfshield.PORT_A,255)
        if button_b.was_pressed():
            display.on()
            display.clear()
            motor.runSpeed(1,100)
            display.show(Image('09990:09090:09900:09090:09990'))
            LIGHT = neopixel.NeoPixel(elfshield.PORT_A, 50)
            display.off()
            pin3.write_analog(6)
            pin3.set_analog_period_microseconds(100000)
            RGB = neopixel.NeoPixel(pin8, 3)
            LIGHT.show()
            servo.angle(1,90)
            pin4.set_analog_period_microseconds(100000)
            RGB = neopixel.NeoPixel(elfshield.PORT_C, 50)
            LIGHT.clear()
            servo.angle(1,90)
        radio.on()
        radio.config(channel=6)
        radio.send(' hello Message')
        display.scroll(radio.receive())
        radio.reset()
        radio.off()
        display.on()
        display.show(Image('09090:99999:09990:00900:88888'))
        compass.calibrate()
        if compass.is_calibrated():
            if (compass.get_field_strength() == 2):
                display.show(Image('11111:10001:10999:10001:11111'))
        if (accelerometer.get_gestures() == accelerometer.is_gesture('9g')):
            display.scroll('e30')
        while True:
            radio.on()
            radio.config(channel=6)
            radio.send(' hello Message')
            display.scroll(radio.receive())
            radio.reset()
            radio.off()
            display.on()
            display.show(Image('09090:99999:09990:00900:88888'))
            compass.calibrate()
            if compass.is_calibrated():
                if (compass.get_field_strength() == 1):
                    display.show(Image('11911:10901:10901:10001:11111'))
            if (accelerometer.get_gestures() == accelerometer.is_gesture('9g')):
                display.scroll('e30')
                elfshield.dc130motor_speed(elfshield.PORT_A,255)
            if button_b.was_pressed():
                display.on()
                display.clear()
                motor.runSpeed(1,100)
                display.show(Image('09990:09090:09900:09090:09990'))
                LIGHT = neopixel.NeoPixel(elfshield.PORT_A, 50)
                display.off()
                pin3.write_analog(6)
            pin3.set_analog_period_microseconds(21535252552)
            RGB = neopixel.NeoPixel(pin8, 3)
            LIGHT.show()
            servo.angle(1,90)
            pin4.set_analog_period_microseconds(100000)
            RGB = neopixel.NeoPixel(elfshield.PORT_C, 50)
            LIGHT.clear()
            servo.angle(1,90)

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页