Microbit 温度传感器

« 返回首页

Microbit Temperature:温度传感器

Microbit_Temperature 传感器使 App Inventor 用户能够配置 BBC micro:bit 的板载温度传感器,并通过适当的方法接收一个或多个温度样本。

温度传感器的报告速率(或周期)决定了向 App Inventor 发送数据的频率。

更多链接:<ul><li>下载 micro:bit 温度传感器的示例项目。</li><li>查看 micro:bit 温度传感器的操作说明。</li></ul>

属性

  • BluetoothDevice – 设置连接到 micro:bit 设备的 BluetoothLE 组件。

get Microbit_Temperature1 BluetoothDevice

set Microbit_Temperature1 BluetoothDevice  to

方法

  • ReadTemperature – Read a single sample of temperature data from the micro:bit. On successful read, the TemperatureDataReceived event will be run.

call Microbit_Temperature1 ReadTemperature

  • ReadTemperaturePeriod – Read the current report rate for the micro:bit’s temperature sensor. After the period is read, it will be received by the TemperaturePeriodReceived event.

call Microbit_Temperature1 ReadTemperaturePeriod

  • RequestTemperatureUpdates – Request notifications of changes in the micro:bit’s temperature sensor. Changes in the temperature will be reported at a rate determined by the last period value set by a call to WriteTemperaturePeriod. Temperature data will be reported through the TemperatureDataReceived event.

call Microbit_Temperature1 RequestTemperatureUpdates

  • StopTemperatureUpdates – Stop receiving updates from the micro:bit’s temperature sensor. Note that there may be pending messages from the device that will still be reported through the TemperatureDataReceived event.

call Microbit_Temperature1 StopTemperatureUpdates

  • WriteTemperaturePeriod – Use the WriteTemperaturePeriod method to change how frequently the micro:bit sends temperature data to App Inventor. The period is measured in milliseconds.

Parameters:

 * <code>temperature_period_value</code> (<a href="http://appinventor.mit.edu/explore/ai2/support/blocks/math.html#number">_number_</a>) &mdash;
   The new reporting period for the micro:bit's temperature sensor.

call Microbit_Temperature1 WriteTemperaturePeriodtemperature_period_value

事件

  • TemperaturePeriodReceived – The TemperaturePeriodReceived event is run after the micro:bit’s temperature reporting period is read from the device.

Parameters:

 * <code>temperature_period_value</code> (<a href="http://appinventor.mit.edu/explore/ai2/support/blocks/math.html#number">_number_</a>) &mdash;
   The current reporting interval for the micro:bit's temperature sensor.

when Microbit_Temperature1 TemperaturePeriodReceived temperature_period_value do

  • TemperatureReceived – The TemperatureReceived event is run whenever temperature samples are received from the micro:bit. This is usually a result of performing a read or request updates operation. The temperature value is measured in degrees Celsius.

Parameters:

 * <code>temperature_value</code> (<a href="http://appinventor.mit.edu/explore/ai2/support/blocks/math.html#number">_number_</a>) &mdash;
   The temperature measured by the micro:bit, in degrees Celsius

when Microbit_Temperature1 TemperatureReceived temperature_value do

  • WroteTemperaturePeriod – The WroteTemperaturePeriod event is run after the micro:bit’s temperature reporting period is written to the device.

Parameters:

 * <code>temperature_period_value</code> (<a href="http://appinventor.mit.edu/explore/ai2/support/blocks/math.html#number">_number_</a>) &mdash;
   The new reporting interval for the micro:bit's temperature sensor.

when Microbit_Temperature1 WroteTemperaturePeriod temperature_period_value do

文档反馈