From f19b6d2af4348400e1c8fcec3969c06873849523 Mon Sep 17 00:00:00 2001 From: Jason Garland Date: Tue, 20 Oct 2015 22:53:21 -0700 Subject: [PATCH 1/4] added pacman effect --- RGBShades.ino | 3 ++- effects.h | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/RGBShades.ino b/RGBShades.ino index 5583378..2b8b240 100644 --- a/RGBShades.ino +++ b/RGBShades.ino @@ -69,7 +69,8 @@ functionList effectList[] = {threeSine, scrollTextZero, sideRain, shadesOutline, - hearts}; + hearts, + pacman}; // Timing parameters #define cycleTime 15000 diff --git a/effects.h b/effects.h index 6140c2a..9083ee6 100644 --- a/effects.h +++ b/effects.h @@ -388,4 +388,36 @@ void scrollTextOne() { void scrollTextTwo() { scrollText(2, NORMAL, CRGB::Green, CRGB(0,0,8)); -} \ No newline at end of file +} + +//Pacman +const uint8_t Ghost[] = {10, 11, 12, 19, 17, 15, 38, + 39, 40, 41, 42, 49, 48, 47, 46, 45, 63, 65, 67}; +const uint8_t PacManClosed[] = {1, 2, 3, 28, 27, 26, 25, + 24, 31, 32, 33, 34, 35, 56, 55, 54, 53, 52, 59, 60, 61}; +const uint8_t PacManMouth[] = {25, 24, 33, 34, 35, 53, 52}; +void pacman() { + if (effectInit == false) { + effectInit = true; + effectDelay = 225; + FastLED.clear(); + y = 0; + } + if (y==2) + y = 0; + if (y == 0) { + for (int x = 0; x < 21; x++) { + leds[PacManClosed[x]] = CRGB::Yellow; + } + for (int x = 0; x < 19; x++) { + leds[Ghost[x]] = CRGB::Blue; + } + } + if (y == 1) { + for (int x = 0; x < 7; x++) { + leds[PacManMouth[x]] = CRGB::Black; + } + } + y++; +} + From 030641eadf5df1b9edc01bf8b79d923c21662d40 Mon Sep 17 00:00:00 2001 From: Jason Garland Date: Tue, 20 Oct 2015 23:02:08 -0700 Subject: [PATCH 2/4] added moving pellets for pacman effect --- effects.h | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/effects.h b/effects.h index 9083ee6..41aa7f2 100644 --- a/effects.h +++ b/effects.h @@ -396,28 +396,52 @@ const uint8_t Ghost[] = {10, 11, 12, 19, 17, 15, 38, const uint8_t PacManClosed[] = {1, 2, 3, 28, 27, 26, 25, 24, 31, 32, 33, 34, 35, 56, 55, 54, 53, 52, 59, 60, 61}; const uint8_t PacManMouth[] = {25, 24, 33, 34, 35, 53, 52}; +const uint8_t Pellets1[] = {34, 36}; +const uint8_t Pellets2[] = {33, 35, 37, 43}; void pacman() { if (effectInit == false) { effectInit = true; - effectDelay = 225; + effectDelay = 175; FastLED.clear(); y = 0; } - if (y==2) + if (y==3) y = 0; if (y == 0) { + for (int x = 0; x < 2; x++) { + leds[Pellets1[x]] = CRGB::White; + } + for (int x = 0; x < 4; x++) { + leds[Pellets2[x]] = CRGB::Black; + } for (int x = 0; x < 21; x++) { leds[PacManClosed[x]] = CRGB::Yellow; } + for (int x = 0; x < 7; x++) { + leds[PacManMouth[x]] = CRGB::Black; + } for (int x = 0; x < 19; x++) { leds[Ghost[x]] = CRGB::Blue; } } if (y == 1) { - for (int x = 0; x < 7; x++) { - leds[PacManMouth[x]] = CRGB::Black; + for (int x = 0; x < 2; x++) { + leds[Pellets1[x]] = CRGB::Black; + } + for (int x = 0; x < 4; x++) { + leds[Pellets2[x]] = CRGB::White; + } + } + if (y == 2) { + for (int x = 0; x < 2; x++) { + leds[Pellets1[x]] = CRGB::White; + } + for (int x = 0; x < 4; x++) { + leds[Pellets2[x]] = CRGB::Black; + } + for (int x = 0; x < 21; x++) { + leds[PacManClosed[x]] = CRGB::Yellow; } } y++; } - From 58c2a6d87782dbc38c182846026af771923a0f5f Mon Sep 17 00:00:00 2001 From: Jason Garland Date: Tue, 20 Oct 2015 23:13:27 -0700 Subject: [PATCH 3/4] why use y? --- effects.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/effects.h b/effects.h index 41aa7f2..be32780 100644 --- a/effects.h +++ b/effects.h @@ -398,16 +398,16 @@ const uint8_t PacManClosed[] = {1, 2, 3, 28, 27, 26, 25, const uint8_t PacManMouth[] = {25, 24, 33, 34, 35, 53, 52}; const uint8_t Pellets1[] = {34, 36}; const uint8_t Pellets2[] = {33, 35, 37, 43}; +int pacman_step = 0; void pacman() { if (effectInit == false) { effectInit = true; effectDelay = 175; FastLED.clear(); - y = 0; } - if (y==3) - y = 0; - if (y == 0) { + if (pacman_step==3) + pacman_step = 0; + if (pacman_step == 0) { for (int x = 0; x < 2; x++) { leds[Pellets1[x]] = CRGB::White; } @@ -424,7 +424,7 @@ void pacman() { leds[Ghost[x]] = CRGB::Blue; } } - if (y == 1) { + if (pacman_step == 1) { for (int x = 0; x < 2; x++) { leds[Pellets1[x]] = CRGB::Black; } @@ -432,7 +432,7 @@ void pacman() { leds[Pellets2[x]] = CRGB::White; } } - if (y == 2) { + if (pacman_step == 2) { for (int x = 0; x < 2; x++) { leds[Pellets1[x]] = CRGB::White; } @@ -443,5 +443,5 @@ void pacman() { leds[PacManClosed[x]] = CRGB::Yellow; } } - y++; + pacman_step++; } From dc2f55fc36c425fcfaf1fb979fe661861bd5cf77 Mon Sep 17 00:00:00 2001 From: Jason Garland Date: Wed, 21 Oct 2015 01:03:36 -0700 Subject: [PATCH 4/4] fixed pellets in pacman effect --- effects.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/effects.h b/effects.h index be32780..42d6f63 100644 --- a/effects.h +++ b/effects.h @@ -397,7 +397,7 @@ const uint8_t PacManClosed[] = {1, 2, 3, 28, 27, 26, 25, 24, 31, 32, 33, 34, 35, 56, 55, 54, 53, 52, 59, 60, 61}; const uint8_t PacManMouth[] = {25, 24, 33, 34, 35, 53, 52}; const uint8_t Pellets1[] = {34, 36}; -const uint8_t Pellets2[] = {33, 35, 37, 43}; +const uint8_t Pellets2[] = {35, 37, 43}; int pacman_step = 0; void pacman() { if (effectInit == false) { @@ -411,7 +411,7 @@ void pacman() { for (int x = 0; x < 2; x++) { leds[Pellets1[x]] = CRGB::White; } - for (int x = 0; x < 4; x++) { + for (int x = 0; x < 3; x++) { leds[Pellets2[x]] = CRGB::Black; } for (int x = 0; x < 21; x++) { @@ -428,7 +428,7 @@ void pacman() { for (int x = 0; x < 2; x++) { leds[Pellets1[x]] = CRGB::Black; } - for (int x = 0; x < 4; x++) { + for (int x = 0; x < 3; x++) { leds[Pellets2[x]] = CRGB::White; } } @@ -436,7 +436,7 @@ void pacman() { for (int x = 0; x < 2; x++) { leds[Pellets1[x]] = CRGB::White; } - for (int x = 0; x < 4; x++) { + for (int x = 0; x < 3; x++) { leds[Pellets2[x]] = CRGB::Black; } for (int x = 0; x < 21; x++) { @@ -445,3 +445,4 @@ void pacman() { } pacman_step++; } +