Commanders
Arduino buttons/bus library
|
#include "ButtonsCommanderSwitchOnePin.hpp"
Public Member Functions | |
ButtonsCommanderSwitchOnePin () | |
void | begin (unsigned long inId, int inPin) |
void | beforeFirstLoop () |
unsigned long | loop () |
![]() | |
ButtonsCommanderButton (unsigned long inId) | |
unsigned long | GetId () const |
virtual ButtonsCommanderButton * | GetFromId (unsigned long inId) |
virtual int | GetPosition () const |
virtual void | EndLoop () |
void | SetNextButton (ButtonsCommanderButton *inpButton) |
ButtonsCommanderButton * | GetNextButton () const |
Additional Inherited Members | |
![]() | |
unsigned long | Id |
A switch can be used in a On/Off way. In this case only one Arduino pin is connected to the switch. The event raised is always of type COMMANDERS_EVENT_MOVE and data is COMMANDERS_MOVE_ON or COMMANDERS_MOVE_OFF.
Events thrown:
reason | id | type | data |
---|---|---|---|
pin state to HIGH | button id | COMMANDERS_EVENT_MOVE | COMMANDERS_MOVE_ON |
pin state to LOW | button id | COMMANDERS_EVENT_MOVE | COMMANDERS_MOVE_OFF |
ButtonsCommanderSwitchOnePin::ButtonsCommanderSwitchOnePin | ( | ) |
Default constructor.
|
virtual |
This function will be called after sketch Setup(), but before the first call to loop(). It will be called only one time.
Reimplemented from ButtonsCommanderButton.
void ButtonsCommanderSwitchOnePin::begin | ( | unsigned long | inId, |
int | inPin | ||
) |
Initialize the instance.
inId | id of the button. |
inPin | Arduino pin connected to the switch button. |
|
virtual |
Main loop function.
Reimplemented from ButtonsCommanderButton.