-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed function from boolean to accepting a fade rate in 1/2 milliseconds. Each value equates to 500 microseconds delay.
- Loading branch information
Arnd
authored and
Arnd
committed
Dec 18, 2016
1 parent
9637f37
commit e939263
Showing
2 changed files
with
42 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,16 @@ | |
** voltage for the red is 2.0V and the green/blue LEDs have 3.3V and with a 25mA current that equates to resistors** | ||
** at 120 and 68 Ohms respectively. ** | ||
** ** | ||
** The pushbutton has a pull-down resistor of 4.7KOhm to reduce bounce ** | ||
** The pushbutton should have a pull-down resistor of 4.7KOhm to reduce bounce. The sample breadboard schematic ** | ||
** used for the examples for this library can be located at in Github at the following address: ** | ||
** https://github.com/SV-Zanshin/RotaryEncoder/blob/master/Images/RotaryEncoder.png ** | ||
** ** | ||
** Although programming for the Arduino and in c/c++ is new to me, I'm a professional programmer and have learned,** | ||
** over the years, that it is much easier to ignore superfluous comments than it is to decipher non-existent ones;** | ||
** so both my comments and variable names tend to be verbose. The code is written to fit in the first 80 spaces ** | ||
** and the comments start after that and go to column 117 - allowing the code to be printed in A4 landscape mode. ** | ||
** There are several parts of code which can be somewhat optimized, but in order to make the c++ code more under- ** | ||
** standable by non-programmers some performance has been sacrificed for legibility and maintainability. ** | ||
** ** | ||
** This program is free software: you can redistribute it and/or modify it under the terms of the GNU General ** | ||
** Public License as published by the Free Software Foundation, either version 3 of the License, or (at your ** | ||
|
@@ -37,6 +46,7 @@ | |
** ** | ||
** Vers. Date Developer Comments ** | ||
** ====== ========== =================== ======================================================================== ** | ||
** 1.0.2 2016-12-18 [email protected] Changed SetFade() to SetFadeRate() function to alter the fade speed ** | ||
** 1.0.1 2016-12-14 [email protected] Fixed error on condition to turn off LED lights. ** | ||
** 1.0.0 2016-12-14 [email protected] Allowed defaults for LEDs on class constructer ** | ||
** 1.0.b3 2016-12-13 [email protected] Made fading start only after the maximum setting was reached ** | ||
|
@@ -57,7 +67,7 @@ | |
static void TimerISR(); // Interim ISR calls real handler // | ||
void SetEncoderValue(const int16_t NewValue = 0); // Set the encoder value // | ||
void SetLEDState(const bool Status); // Turns encoder LEDs on or off // | ||
void SetFade(const bool FadeState); // Sets the fader state // | ||
void SetFadeRate(uint8_t FadeMillis); // Sets the fader state and speed // | ||
void SetColor(const uint8_t R, const uint8_t G, const uint8_t B);// Sets the LED colors // | ||
void SetPushButtonColor(const uint8_t R, const uint8_t G, // Sets the RGB values displayed // | ||
const uint8_t B); // when the pushbutton is pressed // | ||
|
@@ -78,7 +88,7 @@ | |
uint8_t _RedPin; // // | ||
uint8_t _GreenPin; // // | ||
uint8_t _BluePin; // // | ||
bool _Fade = true; // Default to fade to dark // | ||
uint8_t _FadeMillis = 1; // 1=fast, 0=Off // | ||
bool _LEDOn = true; // Default to display LED lights // | ||
volatile bool _LEDChanged = true; // Set when rotate or click changes // | ||
volatile uint8_t _ButtonPresses = 0; // The current number of pushes // | ||
|