LED红.png

LED有红色、蓝色、绿色、黄色,仅颜色不用,使用方式完全相同。

参考程序

请参考程序连接:https://makecode.microbit.org/_5h3d8bVfjWsA

你也可以通过以下网页直接下载程序,下载完成后即可开始运行程序。




image.png

Python 参考程序

  1. from microbit import *
  2. from enum import *
  3. from light import *
  4. while True:
  5. light = LIGHT(J1)
  6. light_value = int(light.get_lightlevel())
  7. display.scroll(str(light_value))
  8. sleep(2000)