Skip to content

Commit

Permalink
Brightness setting works
Browse files Browse the repository at this point in the history
  • Loading branch information
Jade Meskill and Roy van de Water authored and Roy van de Water committed Jan 8, 2014
1 parent 1a6692a commit 76127ff
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/TestStatus.ino
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,14 @@ bool is_color(char character) {
}

void pulse() {
if (mPulseInterval < 0) {
if (mPulseInterval <= 0) {
LEDS.setBrightness(mBrightness);
return;
}

int now = (millis() / mPulseInterval) % (mBrightness * 2);
LEDS.setBrightness(abs(mBrightness - now));
int now = (millis() / mPulseInterval) % (93 * 2);
int phase = 93 - now;
LEDS.setBrightness(abs(phase * mBrightness / 93));
LEDS.show();
}

Expand All @@ -82,7 +83,7 @@ void rainbow() {
}

void set_brightness(char character) {
if (character < 48 and character > 57) {
if (character < 48 || 57 < character) {
return;
}

Expand All @@ -109,7 +110,7 @@ void set_pulse_interval(char mode) {
mPulseInterval = 2;
return;
case 'p':
mPulseInterval = 5;
mPulseInterval = 4;
return;
case 's':
mPulseInterval = 0;
Expand Down

0 comments on commit 76127ff

Please sign in to comment.