【问题标题】:I get AttributeError on micro:bit examples我在 micro:bit 示例上得到 AttributeError
【发布时间】:2021-05-25 07:14:00
【问题描述】:

我一直在尝试 micro:bit 无线电示例,但我无法让它们按照例如中的说明工作,

radio.send_string("Hello World")

会显示以下错误

AttributeError: 'module' object has no attribute 'send_string'

但是如果我使用

radio.send("Hello World")

该程序运行良好。它发生在文档中的许多说明中,例如在尝试使用时

input.light_level()

我明白了

AttributeError: 'function' object has no attribute 'light_level'

但是我在文档中找不到的以下内容可以正常工作

display.read_light_level()

我错过了什么?

编辑:我在 Chrome 上使用在线 micro:bit python 编辑器

【问题讨论】:

    标签: python micropython bbc-microbit


    【解决方案1】:

    网上有两个 Python 编辑器,它们使用两个不同的 Python 库。

    1. 制作代码:https://makecode.microbit.org/#editor
    2. https://python.microbit.org/v/2

    看起来您正在使用第二个使用 MicroPython 的编辑器,并记录在: https://microbit-micropython.readthedocs.io/

    【讨论】:

      猜你喜欢
      • 2022-10-06
      • 2021-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-09
      相关资源
      最近更新 更多