Arduino101 引脚

« 返回首页

Arduino101Pins 引脚

Arduino101Pins 扩展为连接到 Arduino 的数字或模拟 I/O 引脚的任何硬件提供了通用接口。

属性

  • Analog – 设置或获取引脚是否为模拟引脚(true)或数字引脚(false)。默认值:数字(false)。

get Arduino101Pins1 Analog

set Arduino101Pins1 Analog  to

  • BluetoothDevice – 连接到Arduino 101的BluetoothLE组件。

get Arduino101Pins1 BluetoothDevice

set Arduino101Pins1 BluetoothDevice  to

  • Output – 设置或获取引脚是输入还是输出引脚。仅适用于数字引脚。模拟引脚是只读的。要将数字引脚作为”模拟”输出,请参阅Arduino 101 PWM扩展。默认值:输入(false)。

get Arduino101Pins1 Output

set Arduino101Pins1 Output  to

  • Pin – 要读取或写入的Arduino引脚。默认值:0。

get Arduino101Pins1 Pin

set Arduino101Pins1 Pin  to

方法

  • IsSupported – 检查通过BluetoothDevice属性连接的设备当前是否支持该功能。如果当前没有设备连接,此方法将始终返回false。

call Arduino101Pins1 IsSupported

  • ReadPinState – 读取引脚的当前状态。读取值后,将通过PinStateReceived事件报告。

call Arduino101Pins1 ReadPinState

  • RequestPinStateUpdates – 请求获取引脚状态的更新。新值将通过 PinStateReceived事件报告。

call Arduino101Pins1 RequestPinStateUpdates

  • UnregisterForUpdates – 停止接收引脚的更新。请注意,在此调用后可能仍有待处理的PinStateReceived事件通知需要处理。

call Arduino101Pins1 UnregisterForUpdates

  • WritePinState – 为引脚写入新值。仅当Output属性设置为true时才是有效操作。对于数字引脚,非零值将转换为1(HIGH),零值将转换为0(LOW)。对于模拟引脚,值必须在0到1023之间(包含)。超出此范围的任何值将被截断。要使用脉宽调制将模拟输出写入数字引脚,请参阅Arduino101PWM扩展。

Parameters:

 * <code>value</code> (<a href="http://appinventor.mit.edu/explore/ai2/support/blocks/math.html#number">_number_</a>) &mdash;
   The value to write to the pin. Valid values depend on whether the pin is digital or analog.

call Arduino101Pins1 WritePinStatevalue

事件

  • PinStateReceived – 当引脚被读取或接收到更新时,将运行PinStateReceived事件以通知应用程序引脚状态。value参数将指示引脚状态。对于数字引脚,0表示关闭,1表示开启。对于模拟引脚,它将是[0, 1023]范围内的整数。

Parameters:

 * <code>value</code> (<a href="http://appinventor.mit.edu/explore/ai2/support/blocks/math.html#number">_number_</a>) &mdash;
   The value of the pin read from the Arduino. Valid values depend on whether the pin
   is digital or analog. For digital pins, a 0 indicates LOW and 1 indicates HIGH.
   For analog, an integer in the range of [0, 1023] will be returned.

when Arduino101Pins1 PinStateReceived value do

  • PinStateWritten – 当引脚被写入后,将运行PinStateWritten事件以指示操作成功。value参数将指示从App Inventor应用程序写入Arduino的值,不一定是调用者传递给WritePinState的值。例如,对于模拟引脚,值将被截断以适应[0, 1023]的范围。

Parameters:

 * <code>value</code> (<a href="http://appinventor.mit.edu/explore/ai2/support/blocks/math.html#number">_number_</a>) &mdash;
   The value written to the Arduino. Valid values depend on whether the pin is
   digital or analog. This value is the value written after any transformation by
   the extension to fit the range appropriate to the pin type.

when Arduino101Pins1 PinStateWritten value do

文档反馈