6、远距离控制光线采集与记录
#MicroPython动手做(22)——掌控板之无线广播
#远距离控制光线采集与记录(控制端)
- #MicroPython动手做(22)——掌控板之无线广播
- #远距离控制光线采集与记录(控制端)
-
- import radio
- from mpython import *
- import time
-
-
- radio.on()
- radio.config(channel=5)
- oled.fill(0)
- oled.DispChar("光线数据采集", 0, 0, 1)
- oled.DispChar("按A键采集,按B键结束", 0, 16, 1)
- oled.show()
- while True:
- if button_a.value() == 0:
- rgb[1] = (int(0), int(102), int(0))
- rgb.write()
- time.sleep_ms(1)
- oled.fill_rect(0, 32, 128, 16, 0)
- oled.DispChar((str(light.read())), 0, 32, 1)
- oled.show()
- radio.send((str(light.read())))
- time.sleep_ms(100)
- if button_b.value() == 0:
- rgb[1] = (int(102), int(0), int(0))
- rgb.write()
- time.sleep_ms(1)
- oled.fill_rect(0, 32, 128, 16, 0)
- oled.show()
- radio.off()
复制代码
|