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 previous pin state to LOW | button id | COMMANDERS_EVENT_MOVE | COMMANDERS_MOVE_OFF
Definition at line 20 of file ButtonsCommanderSwitchOnePin.hpp.
ButtonsCommanderSwitchOnePin::ButtonsCommanderSwitchOnePin | ( | ) |
Default constructor.
Definition at line 11 of file ButtonsCommanderSwitchOnePin.cpp.
|
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.
Definition at line 25 of file ButtonsCommanderSwitchOnePin.cpp.
void ButtonsCommanderSwitchOnePin::begin | ( | unsigned long | inId, |
int | inPin | ||
) |
Initialize the instance.
inId | id of the button. |
inPin | Arduino pin connected to the switch button. |
Definition at line 17 of file ButtonsCommanderSwitchOnePin.cpp.
|
virtual |
Main loop function.
Reimplemented from ButtonsCommanderButton.
Definition at line 38 of file ButtonsCommanderSwitchOnePin.cpp.