2017년 7월 6일 목요일

Arduino101Pins


The Arduino101Pins extension provides a general purpose interface to any hardware connected to the Arduino's digital or analog I/O pins.

Properties

⦁ Analog – Set or get whether the pin is an analog pin (true) or digital pin (false). Default: digital (false).

get Arduino101Pins1 Analog
set Arduino101Pins1 Analog  to
⦁ BluetoothDevice – The BluetoothLE component with a connection to the Arduino 101.
get Arduino101Pins1 BluetoothDevice
set Arduino101Pins1 BluetoothDevice  to
⦁ Output – Set or get whether the pin is an input or output pin. This only applies to digital pins. Analog pins are read-only. See the Arduino 101 PWM extension for treating digital pins as 'analog' outputs. Default: input (false).
get Arduino101Pins1 Output
set Arduino101Pins1 Output  to
⦁ Pin – The Arduino pin to read or write. Default: 0.
get Arduino101Pins1 Pin
set Arduino101Pins1 Pin  to

Methods

⦁ IsSupported – Check whether the feature is currently available for the device connected via theBluetoothDevice property. If no device is currently connected, this method will always return false.

call Arduino101Pins1 IsSupported
⦁ ReadPinState – Read the current state of the pin. After the value is read, it will be reported through thePinStateReceived event.
call Arduino101Pins1 ReadPinState
⦁ RequestPinStateUpdates – Request updates to the state of the pin. New values will be reported by thePinStateReceived event.
call Arduino101Pins1 RequestPinStateUpdates
⦁ UnregisterForUpdates – Stop receiving updates for the pin. Note that there still may be pending notifications to the PinStateReceived event that will need to be processed after this call.
call Arduino101Pins1 UnregisterForUpdates
⦁ WritePinState – Write a new value for the pin. This is only a valid operation if the Output property is set to true. For digital pins, a non zero value will be converted to 1 (HIGH) and a zero value will be converted to 0 (LOW). For analog pins, the value must be between 0 and 1023, inclusive. Any values outside of this range will be truncated. To write analog outputs to digital pins using pulse width modulation, see the Arduino101PWM extension.
   Parameters:
   ⚬ value (number) — The value to write to the pin. Valid values depend on whether the pin is digital or analog.
call Arduino101Pins1 WritePinStatevalue

Events

⦁ PinStateReceived – After the pin is read or an update is received, the PinStateReceived event will be run to inform the app about the state of the pin. The value parameter will indicate the pin state. For digital pins, it will be either 0 for off or 1 for on. For analog pins, it will be an integer in the range [0, 1023].

   Parameters:
   ⚬ value (number) — 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 – After the pin is written, the PinStateWritten event will be run to indicate a successful operation. The value parameter will indicate the value written to the Arduino from the App Inventor app, not necessarily the value passed by the caller to WritePinState. For example, in the case of the analog pins the value will be truncated to fit within the range of [0, 1023].
   Parameters:
   ⚬ value (number) — 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


댓글 없음:

댓글 쓰기