Mutila: Mouse's Utilities for Arduino
Oft-used utilities: debouncing buttons, averaging samples, and so on.
|
#include <DiscretePot.h>
Public Member Functions | |
DiscretePot (const uint8_t pin) | |
void | begin (int8_t min=0, int8_t max=11, bool reversed=false, uint8_t threshold=AbstractDebouncedButton::DefaultThreshold, uint8_t delay=AbstractDebouncedButton::DefaultButtonDelay) |
void | update () |
int8_t | value () |
Discrete values from a potential divider.
Monitors an analog input pin and converts the voltage on the input to a discrete value within a specified range (the default goes up to 11).
Definition at line 12 of file DiscretePot.h.
DiscretePot::DiscretePot | ( | const uint8_t | pin | ) |
Constructor.
pin | the analog input pin to monitor (e.g. A0) |
Definition at line 5 of file DiscretePot.cpp.
void DiscretePot::begin | ( | int8_t | min = 0 , |
int8_t | max = 11 , |
||
bool | reversed = false , |
||
uint8_t | threshold = AbstractDebouncedButton::DefaultThreshold , |
||
uint8_t | delay = AbstractDebouncedButton::DefaultButtonDelay |
||
) |
Initializtion.
min | the minimum value |
max | the maximum value |
reversed | set to true to reverse the scale (return max when analogRead is at 0) |
threshold | debouncing threshold (see DebouncedButton for details) |
delay | debouncing delay (see DebouncedButton for details) |
Definition at line 10 of file DiscretePot.cpp.
void DiscretePot::update | ( | ) |
Allocate Timeslice.
This method must be called frequently - usually from loop()
Definition at line 20 of file DiscretePot.cpp.
int8_t DiscretePot::value | ( | ) |