The Arduino101Button component lets users listen to events triggered by a button connected to a digital pin on the Arduino. The extension responds to voltage changes on the specified digital
Pin
and so can be used to respond to any hardware component that signals high/low based on some external phenomenon, such as a motion detector.
More links:
Properties
⦁
Pin
– The Pin on the Arduino board that the device is wired in to.Methods
⦁
IsSupported
– Tests whether the Bluetooth low energy device is broadcasting support for the service. If true, calls to TurnOn and TurnOff should work correctly. Otherwise an error will be reported through the Screen's ErrorOccurred event.
⦁
ReadButtonState
– Read the current state of the button as reported by the Arduino. On success, theButtonStateReceived
event will be run. If the state of the button has changed, the Pressed
or Released
events will be run as well.
⦁
RequestButtonStateUpdates
– Request notifications from the Arduino for changes in the button state. The ButtonStateReceived
event will be run after every sample is received, even if no change occurs. If a change in the state occurs, either the Pressed
or the Released
event will be run.
⦁
StopButtonStateUpdates
– Stop listening for notifications of button states from the Arduino. This only has an effect if there was a previous call to RequestButtonStateUpdates
. There may be additional pending messages that will be processed after this call, so if accuracy in the data delivery are important an additional variable should be used to track the state of event processing.Events
⦁
ButtonStateReceived
– The ButtonStateReceived
event is run when any button state is received by the Bluetooth low energy component from the Arduino. This state value may be the same for extended periods of time if the button switch is left in an open or closed state.
Parameter:
⦁
Pressed
– The Pressed
event is run when a button state is observed to go from a low signal to a high signal, indicating that the button switch has been pressed and the circuit is closed.
⦁
Released
– The Released
event is run when a button state is observed to go from a high signal to a low signal, indicating that the button switch has been released and the circuit is open.
댓글 없음:
댓글 쓰기