![]() |
Can Opener - ME 507
|
Class which reads from a limit switch. More...
#include <limitSwitch.h>
Public Member Functions | |
| LimitSwitch (uint8_t switchID, uint8_t inPin) | |
| Constructor for the LimitSwitch class. More... | |
| bool | readSwitch (void) |
| Reads the condition of the limit switch. More... | |
Protected Attributes | |
| uint8_t | switchID |
| ID of switch. | |
| uint8_t | inPin |
| Input pin on board | |
| bool | triggered |
| Triggered status. | |
Class which reads from a limit switch.
This class reads a limit switch and determines which state it is in. Note that limit switches can be wired pretty differently from switch to switch, so it is up to the user to determine which boolean value corresponds with each switch state
| LimitSwitch::LimitSwitch | ( | uint8_t | switchID, |
| uint8_t | inPin | ||
| ) |
Constructor for the LimitSwitch class.
This constructor sets an ID for the switch and sets which pin the limit switch is connected to.
| switchID | The ID of this object |
| inPin | The pin the limit switch is connected to. |
| bool LimitSwitch::readSwitch | ( | void | ) |
Reads the condition of the limit switch.
Returns true if the inPin is set high. This doesn't necessarily mean depressed or not, because it relies on how the limit switch is wired