|
TDuino
Convenient functionality for Arduino
|
Output functionality for a pin. More...
#include <TPinOutput.h>
Public Member Functions | |
| TPinOutput () | |
| Default constructor for TPinOutput. More... | |
| virtual void | attach (byte pin, byte mode=OUTPUT) |
| Attach the instance of TPinOutput to a pin. More... | |
| void | oscillate (unsigned int intervalRising, unsigned int intervalFalling, unsigned int repetitions, int initialState, int stateLowest, int stateHighest) |
| Oscillates a pin using PWM. More... | |
| void | oscillate (unsigned int intervalRising, unsigned int intervalFalling, unsigned int repetitions, int initialState) |
| void | oscillate (unsigned int interval, unsigned int repetitions, int initialState) |
| void | oscillate (unsigned int interval, unsigned int repetitions) |
| void | oscillate (unsigned int interval) |
| void | pulse (unsigned int intervalLow, unsigned int intervalHigh, unsigned int repetitions, int initialState) |
| Pulses a pin between by switching it between LOW and HIGH. More... | |
| void | pulse (unsigned int interval, unsigned int repetitions, int initialState) |
| void | pulse (unsigned int interval, unsigned int repetitions) |
| void | pulse (unsigned int interval) |
| virtual void | loop () |
| The extended pins loop phase. More... | |
| void | stop () |
| Stop the current pin task. More... | |
Public Member Functions inherited from TPin | |
| TPin () | |
| Default constructor for the TPin class. More... | |
| void | enable (byte on) |
| Enable / disable a digital pin. More... | |
| void | flip () |
| Flip pin state. More... | |
| void | off () |
| Turn off the pin. More... | |
| void | on () |
| Turn on the pin. More... | |
| void | pwm (int value) |
| Set the pin to a PWM value. More... | |
| int | read () |
| Read the value from the pin. More... | |
| byte | state () |
| Get the digital state of the pin. More... | |
| bool | isAnalog () |
| Checks if the pin is analog. More... | |
| bool | hasPwm () |
| Checkt if the pin has PWM capabilities. More... | |
| byte | getMode () |
| Get the pin's mode. More... | |
| byte | getPin () |
| Get the pin's number. More... | |
Public Member Functions inherited from TBase | |
| TBase () | |
| Constructor for class TBase. More... | |
| virtual | ~TBase () |
| Destructor for class TBase. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from TPin | |
| bool | isPinValid (const char *token=NULL) |
| bool | isPwmValid (int &value, const char *token=NULL) |
Protected Member Functions inherited from TBase | |
| virtual void | defaults () |
| Method used to reset all class internal variables. More... | |
Protected Attributes inherited from TPin | |
| byte | pin |
| The pin assigned to this instance. | |
| byte | mode |
| The mode used for the pin (INPUT / INPUT_PULLUP / OUTPUT). The two high order bits are used to store additional info about the pin. | |
Protected Attributes inherited from TBase | |
| unsigned long | loopMillis |
| The value of millis() to be used within loop() | |
Output functionality for a pin.
Extends the basic pin features with additional functionality like pulsing and oscillating.
| TPinOutput::TPinOutput | ( | ) |
Default constructor for TPinOutput.
Please see docs for the default constructor of TPin.
|
virtual |
Attach the instance of TPinOutput to a pin.
| pin | See TPin::attach() |
| mode | See TPin::attach() |
The value of mode is ignored, always set to OUTPUT.
Reimplemented from TPin.
|
virtual |
The extended pins loop phase.
You must ensure that this method is called regularly or else any active task will not be performed.
Reimplemented from TBase.
| TPinOutput::oscillate | ( | unsigned int | intervalRising, |
| unsigned int | intervalFalling, | ||
| unsigned int | repetitions, | ||
| int | initialState, | ||
| int | stateLowest, | ||
| int | stateHighest | ||
| ) |
Oscillates a pin using PWM.
| intervalRising | Milliseconds from low to high. |
| intervalFalling | Milliseconds from high to low. |
| repetitions | Number of repetitions to perform (default = 0). |
| initialState | The initial PWM value to start from (default = 0). |
| stateLowest | The lowest PWM value to use (default = 0). |
| stateHighest | The highest PWM value to use (default = 255). |
This method will oscillate a PWM signal between the lowest value defined by stateLowest and the highest value defined by stateHighest. The amount of milliseconds it takes from lowest to highest is defined with intervalRising and intervalFalling defines the equivalent for high to low. The oscillation will start at initialState and it will keep oscillating until repetitions oscillations has been performed. If repetitions is zero it will oscillate forever.
The overloaded versions of this method will use the default values described above to define the omitted parameters.
NOTE: If initialState is not equal to stateLowest or stateHighest, it will be mapped to whichever of the two values is the nearest.
| TPinOutput::oscillate | ( | unsigned int | intervalRising, |
| unsigned int | intervalFalling, | ||
| unsigned int | repetitions, | ||
| int | initialState | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| TPinOutput::oscillate | ( | unsigned int | interval, |
| unsigned int | repetitions, | ||
| int | initialState | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
interval will be used for both intervalRising and intervalFalling.
| TPinOutput::oscillate | ( | unsigned int | interval, |
| unsigned int | repetitions | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
interval will be used for both intervalRising and intervalFalling.
| TPinOutput::oscillate | ( | unsigned int | interval | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
interval will be used for both intervalRising and intervalFalling.
| TPinOutput::pulse | ( | unsigned int | intervalLow, |
| unsigned int | intervalHigh, | ||
| unsigned int | repetitions, | ||
| int | initialState | ||
| ) |
Pulses a pin between by switching it between LOW and HIGH.
| intervalLow | Milliseconds for the pin to be LOW. |
| intervalHigh | Milliseconds for the pin to be HIGH. |
| repetitions | Number of pulses to perform (default = 0). |
| initialState | The initial state of the pulse (default = LOW). |
This will start a pulse on the pin which will be LOW for intervalLow milliseconds and then HIGH for intervalHigh milliseconds and so on. the pulse will start as initialState and it will continue until repetition pulses have been performed. If repetitions is zero the pulse will go on forever. initialState will be clamped to a modulus by 2 of the specified value.
The overloaded versions of this method will use the default values described above to define the omitted parameters.
| TPinOutput::pulse | ( | unsigned int | interval, |
| unsigned int | repetitions, | ||
| int | initialState | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
interval will be used as both intervalLow and intervalHigh
| TPinOutput::pulse | ( | unsigned int | interval, |
| unsigned int | repetitions | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
interval will be used as both intervalLow and intervalHigh
| TPinOutput::pulse | ( | unsigned int | interval | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
interval will be used as both intervalLow and intervalHigh
| void TPinOutput::stop | ( | ) |
Stop the current pin task.
If you want to abort / stop an active oscillate or pulse you must call this method.
1.8.15