RSeries astromech firmware
PeriscopeLight.h
Go to the documentation of this file.
1 //
2 // Rotopod Periscope Lighting Kit Code Rev 2.0
3 //
4 //
5 // Updated: March 15, 2013
6 //
7 // Free to use for current R2 Builders Club Members
8 // www.astromech.net
9 //
10 
11 #include <LedControl.h>
12 
13 // GENERAL CONSTANT VARIABLES
14 #define ON 1
15 #define OFF 0
16 
17 // ADDRESS LOCATION for MAX7221 LED Driver
18 #define TOP_RED 0 // TOP 7 LEDS - RED CONTROL SIGNAL
19 #define REAR 1 // BACK 3 LEDS
20 #define BOTTOM 2 // BOTTOM 6 LEDS
21 #define LEFT 3 // LEFT 4 LEDS
22 #define RIGHT 4 // RIGHT 4 LEDS
23 #define CENTER 5 // CENTER 8 LEDS
24 #define TOP_GREEN 6 // TOP 7 LEDS - GREEN CONTROL SIGNAL
25 #define TOP_BLUE 7 // TOP 7 LEDS - BLUE CONTROL SIGNAL
26 
27 // COLOR FOR TOP LED CONTROL FUNCTIONS
28 #define RED 0 // RED...
29 #define GREEN 1
30 #define BLUE 2
31 #define MAGENTA 3
32 #define CYAN 4
33 #define YELLOW 5
34 #define WHITE 6
35 
36 // PATTERN FOR REAR LED CONTROL (ALLOWS FOR ENABLING BI-COLOR LEDS - NOT INCUDED IN KIT)
37 #define REAR_BI_LED_TOP_PIN 0 // THIS CONTROLS THE REAR LED THAT IS SOLDERED TO THE TOP PIN LOCATION ON THE PCB (DEFAULT FOR NON BICOLOR LEDs)
38 #define REAR_BI_LED_BOT_PIN 1 // THIS CONTROLS THE REAR LED THAT IS SOLDERED TO THE BOTTOM PIN LOCATION ON THE PCB (NOT CONNECTED IN KITS)
39 #define REAR_BI_LED_BOTH 2 // THIS CONTROLS BOTH PINS OF A BI-COLOR LED
40 
41 
42 // MAIN 8 LED Flash Pattern
43 #define DIAMOND 0b10101010
44 #define BOX 0b01010101
45 #define POINTUP 0b10010100
46 #define POINTDWN 0b01001001
47 #define ALL 0b11111111
48 
49 // SIDE LED BIT PATTERN: 0b76543210 = FRONT BLUE, FRONT GREEN, FRONT RED, REAR BLUE, REAR GREEN, REAR RED, BOTTOM WHITE, TOP WHITE
50 #define FRONT_RED 0b00100000
51 #define FRONT_GREEN 0b01000000
52 #define FRONT_BLUE 0b10000000
53 #define FRONT_YELLOW 0b01100000
54 #define FRONT_CYAN 0b11000000
55 #define FRONT_MAGENTA 0b10100000
56 #define FRONT_WHITE 0b11100000
57 #define BACK_RED 0b00000100
58 #define BACK_GREEN 0b00001000
59 #define BACK_BLUE 0b00010000
60 #define BACK_YELLOW 0b00001100
61 #define BACK_CYAN 0b00011000
62 #define BACK_MAGENTA 0b00010100
63 #define BACK_WHITE 0b00011100
64 #define BOTH_RED 0b00100100
65 #define BOTH_GREEN 0b01001000
66 #define BOTH_BLUE 0b10010000
67 #define BOTH_YELLOW 0b01101100
68 #define BOTH_CYAN 0b11011000
69 #define BOTH_MAGENTA 0b10110100
70 #define BOTH_WHITE 0b11111100
71 #define TOP_WHITE 0b00000001
72 #define BOTTOM_WHITE 0b00000010
73 #define BOTH_WHITE 0b00000011
74 
75  byte first_time = 1; // used for 3-bit (A B C) input reading - reset all variables
76  // when 3-bit address value changes (except the first time on power up)
77  // State Variables
79  byte RightLEDstate = 0;
80  byte LeftLEDstate = 0;
87  byte SequenceOneState = 0;
88  byte SequenceTwoState = 0;
92  byte SequenceSixState = 0;
95 
100  byte MainFlashState = 0;
101 
102  byte BigLEDOnState = 0;
103 
105  byte BigLEDCodeState = 0;
106 
107  byte Top_Position = 6;
108  byte Bottom_Position = 0;
109  byte center_pos = 0;
110 
111  unsigned long time = 0;
112  unsigned long last_time = 0;
113  unsigned long Main_Loop_Time = 0;
114 
115  unsigned int MainTime = 0;
116 
117  int TopTime = 0;
118  int BottomTime = 0;
119  int RightTime = 0;
120  int LeftTime = 0;
121 
122  int MainSpinTime = 0;
123  int MainFlashTime = 0;
125  int TopFlashTime = 0;
126  int SplitTopTime = 0;
127  int RadiateTopTime = 0;
130 
143 
144  byte Speed = 10;
145  byte Brightness = 15;
146 
147  byte DigInState = 0;
148  byte lastDigInState; //= 0;
149 
150  byte Pattern = 0;
151  byte TopColor = 0;
152  int TopRate = 10;
153  int TopRateOFF = 10;
154 
155  byte FastTopColor = 0;
156  int FastTopRate = 10;
157  int FastTopRateOFF = 10;
158 
159  byte MainPattern = 0;
163  int MainLEDRate = 0;
164  int MainLEDOFF = 0;
165 
166  byte BigLEDCodeON = 0;
167  byte BigLEDCodeOFF = 0;
168 
169  byte BigLEDCodeMode = 0;
170 
171  unsigned int BigLEDCodeTime = 0;
172  unsigned int BigLEDPatternTime = 1000;
173 
174  unsigned int TopLEDCodeTime = 0;
175  unsigned int PatternSelectTime = 1000;
176 
177  unsigned int FastTopLEDCodeTime = 0;
178  unsigned int FastPatternSelectTime = 100;
179  byte FastPattern = 0;
180 
181  unsigned int MainLEDCodeTime = 0;
182  unsigned int MainLEDPatternTime = 0;
183 
184 /*
185  * Create a new controller
186  * Params :
187  * int dataPin The pin on the Arduino where data gets shifted out
188  * int clockPin The pin for the clock
189  * int csPin The pin for selecting the device when data is to be sent
190  * int numDevices The maximum number of devices that can be controled
191  LedControl(int dataPin, int clkPin, int csPin, int numDevices);
192  */
193 LedControl lc=LedControl(12,11,10,1); // Setup MAX7221 LED Drive Signals
194 
195 void setup()
196 {
197  Initialize();
198  randomSeed(analogRead(0)); // Randomizer
199 }
200 
201 //*************************************************************************************//*************************************************************************************//*************************************************************************************
202 //*************************************************************************************//*************************************************************************************//*************************************************************************************
203 
204 
205 void loop()
206 {
207  time = millis(); // get an updated time stamp
208  if (time - last_time > Speed) // check if time has passed to change states - used to slow down the main loop
209  {
210  last_time = time; // reset the timer
211 
212  DigInState = 0; // read in the 3-bit address line
213  if (digitalRead(19) == LOW) // A
214  {DigInState++; }
215  if (digitalRead(18) == LOW) // B
216  {DigInState = DigInState + 2; }
217  if (digitalRead(17) == LOW) // C
218  {DigInState = DigInState + 4; }
219 
220  if(first_time)
221  {
222  lastDigInState = DigInState; // dont allow a change in DigInState values if this is the first time through
223  first_time = 0;
224  }
225 
226  if (DigInState != lastDigInState) //if DigInState has changed...
227  {
228  Initialize(); // Clear all State Variables
229  digitalWrite(5, LOW); // Turn OFF Main LED when reset - in case it was previously ON
230  }
231 
232  lastDigInState = DigInState; // Store the current Input Status
233 
234  switch (DigInState) // Call the appropriate code routine - based on the input address values of the control lines A B C
235  {
236  case 0: // RANDOM: call any color, any pattern, any rate for a random time
237  {
238  MainLEDCode();
239  TopLEDCode();
240  break;
241  }
242  case 1: // Keep ALL Lights Off
243  {
244  Initialize(); // Clear all State Variables
245  digitalWrite(5, LOW); // Turn OFF Main LED (extra safeguard)
246  break;
247  }
248  case 2:
249  {
250  digitalWrite(5, LOW); // Turn OFF Main LED (extra safeguard)
251  ObiWan(20); // Blue Top and Side LED's with some Random Center White LED's
252  break;
253  }
254  case 3:
255  {
256  digitalWrite(5, LOW); // Turn OFF Main LED (extra safeguard)
257  Yoda(100); // Green Top and Side LED's that Fade On and Off - No White LED
258  break;
259  }
260  case 4:
261  {
262  digitalWrite(5, LOW); // Turn OFF Main LED (extra safeguard)
263  Sith(15); // Red Split Bounce on Top LED's with Side LED's Flashing RED - No White LED
264  break;
265  }
266  case 5:
267  {
268  SearchLight(); // Main Light and BIG LED ON
269  break;
270  }
271  case 6:
272  {
273  digitalWrite(5, LOW); // Turn OFF Main LED (extra safeguard)
274  Dagobah(25); // Main Light On, Side Lights White (use Yellow on older harware to help offset the purle-ish color of the RGB), Rear Lights slow blink, Top LED's OFF, Bottom LED's all ON
275  break;
276  }
277  case 7: // FAST RANDOM Changes to All Colors, all locations, all patterns with Sparkle Pattern for White LED's
278  {
279  Sparkle(0);
280  FastTopLEDCode();
281  break;
282  }
283  }
284 
285  } // end of Time Loop
286 } // end of loop
287 
288 
289 //**************************************************************************************************************************************************************************
290 //**************************************************************************************************************************************************************************
291 //
292 // MainLEDCode: This function combines other functions to randomly select all parameters of the Center LEDs
293 //
294 // It randomly selects:
295 // whether the 85 Lumen LED is on or off
296 // the 8 White LED Pattern
297 // whether the 8 LED Pattern Spins or Flashes
298 // the spin or flash rate
299 // the timing for each parameter...
300 
301 
302 
303 void MainLEDCode() // This is for the 8 center white LEDs
304 {
305  switch (MainLEDCodeState)
306  {
307  case 0: // select random parameters
308  {
309  MainPattern = random(0, 2); // randomly select to Spin(0) or Flash(1) the Pattern on the 8 center LEDs
310 
311  MainLEDSpinDirection = random(0, 2);
312  MainLEDSpinNumber = random(1, 6);
313 
314  MainLEDFlashPattern = random(0, 256);
315  MainLEDRate = random(0, 100);
316  MainLEDOFF = random(0, 100);
317 
318  if (random(0,4)>1) // turn ON (don't flash) the randomly selected pattern for the 8 main LED's with a 4/5 probability
319  {
320  MainLEDOFF = 0;
321  }
322  MainLEDPatternTime = random(3000, 12000); // keep the current main LED pattern for 30 seconds to 2 mins before changing
323 
325  }
326  case 1:
327  {
328  switch (MainPattern)
329  {
330  case 0:
331  {
332  MainRingSpin(MainLEDSpinNumber, MainLEDRate, MainLEDSpinDirection); // Number of LED's to Spin (1, 2, 3, 4, 5); Spin Rate (xx miliseconds); Spin Direction: 1 = CLOCKWISE : 0 = CC )
333  break;
334  }
335  case 1:
336  {
337  MainRingFlash(MainLEDFlashPattern, MainLEDRate, MainLEDOFF, 0); // FlashPattern (OFF, DIAMOND, BOX, POINTUP, POINTDWN, ALL); OnTime, OffTime; Randomize (0=OFF : 1=ON) )
338  break;
339  }
340  }
342  {
343  MainLEDCodeTime = 0;
344  MainLEDCodeState = 0;
345  }
346  break;
347  }
348  }//end switch (MainLEDState)
349 }//end MainLEDCode()
350 
351 
352 
353 //**************************************************************************************************************************************************************************
354 //**************************************************************************************************************************************************************************
355 //
356 // TopLEDCode: This function combines other functions to ...
357 //
358 //
360 {
361  switch (SequenceSevenState)
362  {
363  case 0: // select random parameters
364  {
365  if(Pattern == 1) // clear all top leds if bounce pattern was active
366  {
367  SetTopRow(0, WHITE, 0b00000000); // Use White to turn OFF ALL signal lines (RGB)
368  }
369 
370  Pattern = random(0, 4);
371 
372  if(Pattern == 1) // clear all top leds if bounce pattern if going to be active
373  {
374  SetTopRow(0, WHITE, 0b00000000); // Use White to turn OFF ALL signal lines (RGB)
375  }
376 
377  TopColor = random(7);
378  TopRate = random(5, 100);
379  TopRateOFF = random(5, 100);
380 
381  PatternSelectTime = random(3000, 10000); // keep the current LED pattern for 30 sec to 2 mins before changing
383  }
384  case 1:
385  {
386  switch (Pattern)
387  {
388  case 0:
389  {
390  FlashTopLED(0b11111111, TopColor, TopRate, TopRateOFF, 0); // (pattern, color, OnTime, OffTime, Random) Random: 0=(off), 1=(on)
391  break;
392  }
393  case 1:
394  {
395  BounceTopLED(TopColor, TopRate); // COLOR, RATE
396  break;
397  }
398  case 2:
399  {
400  SplitBounceTopLED(TopColor, TopRate); // Color: RED, BLUE, GREEN, YELLOW, CYAN, MAGENTA, WHITE
401  break;
402  }
403  case 3:
404  {
406  break;
407  }
408  }
409  if (TopColor == RED)
410  {
411  RightSideLED(FRONT_RED, BACK_RED, 1, 0); // (Pattern: LOCATION (FRONT, BACK, BOTH) and COLOR - i.e. BACK_GREEN, or BOTH WHITE, OnTime, OffTime)
412  LeftSideLED (FRONT_RED, BACK_RED, 1, 0); // Note - WHITE is TOP or BOTTOM not FRONT/BACK. i.e. TOP_WHITE or BOTH_WHITE
413  }
414  else if (TopColor == GREEN)
415  {
416  RightSideLED(FRONT_GREEN, BACK_GREEN, 1, 0); // (Pattern: LOCATION (FRONT, BACK, BOTH) and COLOR - i.e. BACK_GREEN, or BOTH WHITE, OnTime, OffTime)
417  LeftSideLED (FRONT_GREEN, BACK_GREEN, 1, 0); // Note - WHITE is TOP or BOTTOM not FRONT/BACK. i.e. TOP_WHITE or BOTH_WHITE
418  }
419  else if (TopColor == BLUE)
420  {
421  RightSideLED(FRONT_BLUE, BACK_BLUE, 1, 0); // (Pattern: LOCATION (FRONT, BACK, BOTH) and COLOR - i.e. BACK_GREEN, or BOTH WHITE, OnTime, OffTime)
422  LeftSideLED (FRONT_BLUE, BACK_BLUE, 1, 0); // Note - WHITE is TOP or BOTTOM not FRONT/BACK. i.e. TOP_WHITE or BOTH_WHITE
423  }
424  else if (TopColor == MAGENTA)
425  {
426  RightSideLED(FRONT_MAGENTA, BACK_MAGENTA, 1, 0); // (Pattern: LOCATION (FRONT, BACK, BOTH) and COLOR - i.e. BACK_GREEN, or BOTH WHITE, OnTime, OffTime)
427  LeftSideLED (FRONT_MAGENTA, BACK_MAGENTA, 1, 0); // Note - WHITE is TOP or BOTTOM not FRONT/BACK. i.e. TOP_WHITE or BOTH_WHITE
428  }
429  else if (TopColor == CYAN)
430  {
431  RightSideLED(FRONT_CYAN, BACK_CYAN, 1, 0); // (Pattern: LOCATION (FRONT, BACK, BOTH) and COLOR - i.e. BACK_GREEN, or BOTH WHITE, OnTime, OffTime)
432  LeftSideLED (FRONT_CYAN, BACK_CYAN, 1, 0); // Note - WHITE is TOP or BOTTOM not FRONT/BACK. i.e. TOP_WHITE or BOTH_WHITE
433  }
434  else if (TopColor == YELLOW)
435  {
436  RightSideLED(FRONT_YELLOW, BACK_YELLOW, 1, 0); // (Pattern: LOCATION (FRONT, BACK, BOTH) and COLOR - i.e. BACK_GREEN, or BOTH WHITE, OnTime, OffTime)
437  LeftSideLED (FRONT_YELLOW, BACK_YELLOW, 1, 0); // Note - WHITE is TOP or BOTTOM not FRONT/BACK. i.e. TOP_WHITE or BOTH_WHITE
438  }
439  else if (TopColor == WHITE)
440  {
441  RightSideLED(FRONT_WHITE, BACK_WHITE, 1, 0); // (Pattern: LOCATION (FRONT, BACK, BOTH) and COLOR - i.e. BACK_GREEN, or BOTH WHITE, OnTime, OffTime)
442  LeftSideLED (FRONT_WHITE, BACK_WHITE, 1, 0); // Note - WHITE is TOP or BOTTOM not FRONT/BACK. i.e. TOP_WHITE or BOTH_WHITE
443  }
444 
445  BottomLEDChase(20);
448  RearTopLED (REAR_BI_LED_TOP_PIN, 300, 1000);
449 
451  {
452  TopLEDCodeTime = 0;
453  SequenceSevenState = 0;
454  }
455  break;
456  } // end of case 1:
457  } // end switch
458 } // end()
459 
460 
461 //**************************************************************************************************************************************************************************
462 //**************************************************************************************************************************************************************************
463 //
464 // FastTopLEDCode: This function combines other functions to ...
465 //
466 //
467 
469 {
470  switch (SequenceEightState)
471  {
472  case 0: // select random parameters
473  {
474  if(FastPattern == 1) // clear all top leds if bounce pattern was active
475  {
476  SetTopRow(0, WHITE, 0b00000000); // Use White to turn OFF ALL signal lines (RGB)
477  }
478 
479  FastPattern = random(0, 4);
480 
481  if(FastPattern == 1) // clear all top leds if bounce pattern if going to be active
482  {
483  SetTopRow(0, WHITE, 0b00000000); // Use White to turn OFF ALL signal lines (RGB)
484  }
485 
486  FastTopColor = random(7);
487  FastTopRate = random(2, 10);
488  FastTopRateOFF = random(5, 20);
489 
490  FastPatternSelectTime = random(70, 200);
491 
493  }
494  case 1:
495  {
496  switch (FastPattern)
497  {
498  case 0:
499  {
500  FlashTopLED(0b11111111, FastTopColor, FastTopRate, FastTopRateOFF, 0); // (pattern, color, OnTime, OffTime, Random) Random: 0=(off), 1=(on)
501  break;
502  }
503  case 1:
504  {
505  BounceTopLED(FastTopColor, FastTopRate); // COLOR, RATE
506  break;
507  }
508  case 2:
509  {
510  SplitBounceTopLED(FastTopColor, FastTopRate); // Color: RED, BLUE, GREEN, YELLOW, CYAN, MAGENTA, WHITE
511  break;
512  }
513  case 3:
514  {
516  break;
517  }
518  }
519  if (FastTopColor == RED)
520  {
521  RightSideLED(FRONT_RED, BACK_RED, FastTopRateOFF, FastTopRate); // (Pattern: LOCATION (FRONT, BACK, BOTH) and COLOR - i.e. BACK_GREEN, or BOTH WHITE, OnTime, OffTime)
522  LeftSideLED (FRONT_RED, BACK_RED, FastTopRateOFF, FastTopRate); // Note - WHITE is TOP or BOTTOM not FRONT/BACK. i.e. TOP_WHITE or BOTH_WHITE
523  }
524  else if (FastTopColor == GREEN)
525  {
526  RightSideLED(FRONT_GREEN, BACK_GREEN, FastTopRateOFF, FastTopRate); // (Pattern: LOCATION (FRONT, BACK, BOTH) and COLOR - i.e. BACK_GREEN, or BOTH WHITE, OnTime, OffTime)
527  LeftSideLED (FRONT_GREEN, BACK_GREEN, FastTopRateOFF, FastTopRate); // Note - WHITE is TOP or BOTTOM not FRONT/BACK. i.e. TOP_WHITE or BOTH_WHITE
528  }
529  else if (FastTopColor == BLUE)
530  {
531  RightSideLED(FRONT_BLUE, BACK_BLUE, FastTopRateOFF, FastTopRate); // (Pattern: LOCATION (FRONT, BACK, BOTH) and COLOR - i.e. BACK_GREEN, or BOTH WHITE, OnTime, OffTime)
532  LeftSideLED (FRONT_BLUE, BACK_BLUE, FastTopRateOFF, FastTopRate); // Note - WHITE is TOP or BOTTOM not FRONT/BACK. i.e. TOP_WHITE or BOTH_WHITE
533  }
534  else if (FastTopColor == MAGENTA)
535  {
536  RightSideLED(FRONT_MAGENTA, BACK_MAGENTA, FastTopRateOFF, FastTopRate); // (Pattern: LOCATION (FRONT, BACK, BOTH) and COLOR - i.e. BACK_GREEN, or BOTH WHITE, OnTime, OffTime)
537  LeftSideLED (FRONT_MAGENTA, BACK_MAGENTA, FastTopRateOFF, FastTopRate); // Note - WHITE is TOP or BOTTOM not FRONT/BACK. i.e. TOP_WHITE or BOTH_WHITE
538  }
539  else if (FastTopColor == CYAN)
540  {
541  RightSideLED(FRONT_CYAN, BACK_CYAN, FastTopRateOFF, FastTopRate); // (Pattern: LOCATION (FRONT, BACK, BOTH) and COLOR - i.e. BACK_GREEN, or BOTH WHITE, OnTime, OffTime)
542  LeftSideLED (FRONT_CYAN, BACK_CYAN, FastTopRateOFF, FastTopRate); // Note - WHITE is TOP or BOTTOM not FRONT/BACK. i.e. TOP_WHITE or BOTH_WHITE
543  }
544  else if (FastTopColor == YELLOW)
545  {
546  RightSideLED(FRONT_YELLOW, BACK_YELLOW, FastTopRateOFF, FastTopRate); // (Pattern: LOCATION (FRONT, BACK, BOTH) and COLOR - i.e. BACK_GREEN, or BOTH WHITE, OnTime, OffTime)
547  LeftSideLED (FRONT_YELLOW, BACK_YELLOW, FastTopRateOFF, FastTopRate); // Note - WHITE is TOP or BOTTOM not FRONT/BACK. i.e. TOP_WHITE or BOTH_WHITE
548  }
549  else if (FastTopColor == WHITE)
550  {
551  RightSideLED(FRONT_WHITE, BACK_WHITE, FastTopRateOFF, FastTopRate); // (Pattern: LOCATION (FRONT, BACK, BOTH) and COLOR - i.e. BACK_GREEN, or BOTH WHITE, OnTime, OffTime)
552  LeftSideLED (FRONT_WHITE, BACK_WHITE, FastTopRateOFF, FastTopRate); // Note - WHITE is TOP or BOTTOM not FRONT/BACK. i.e. TOP_WHITE or BOTH_WHITE
553  }
554 
555  BottomLEDChase(25);
558  RearTopLED (REAR_BI_LED_TOP_PIN, 100, 100);
559 
561  {
562  FastTopLEDCodeTime = 0;
563  SequenceEightState = 0;
564  }
565  break;
566  } // end of case 1:
567  } // end switch
568 } // end()
569 
570 
571 //**************************************************************************************************************************************************************************
572 //**************************************************************************************************************************************************************************
573 //
574 // Dagobah: This function combines other functions to simulate the periscope lighting sequence seen in the movie
575 //
576 //
577 
578 void Dagobah(int Rate)
579 {
580 // switch (SequenceOneState)
581 // {
582 // case 0: //
583 // {
584  // BigLED(10, 0); // turn on BIG LED
585 
586  FlashTopLED(0b11111111, WHITE, 0, 1, 0); // turn on all top lights to white
587 
588  MainRingFlash(ALL, 10, 0, 0); // FlashPattern (OFF, DIAMOND, BOX, POINTUP, POINTDWN, ALL); OnTime, OffTime; Randomize (0=OFF : 1=ON) )
589  // RightSideLED(FRONT_WHITE, BACK_YELLOW, 10, 0); // turn on both right side lights to White
590  // LeftSideLED(FRONT_WHITE, BACK_YELLOW, 10, 0); // turn on both right side lights to White
591  RightSideLED(TOP_WHITE, BOTTOM_WHITE, 10, 0); // turn on both right side lights to White
592  LeftSideLED(TOP_WHITE, BOTTOM_WHITE, 10, 0); // turn on both right side lights to White
593 
596  RearTopLED (REAR_BI_LED_TOP_PIN, 300, 1000);
597 
598  BottomLEDFlash(ALL, 10, 0, 0);
599  if (SequenceOneTime++ > Rate)
600  {
601  SequenceOneTime = 0;
602  // SequenceOneState++;
603  }
604 // break;
605 // }
606 // }
607 }
608 
609 //**************************************************************************************************************************************************************************
610 //**************************************************************************************************************************************************************************
611 //
612 // Sith: This function combines other functions to enable a flashing red light sequence
613 //
614 //
615 
616 void Sith(int Rate)
617 {
618  switch (SequenceTwoState)
619  {
620  case 0:
621  {
622  RightSideLED(FRONT_RED, BACK_RED, 0, 1); // turn OFF both right side lights
623  LeftSideLED (FRONT_RED, BACK_RED, 0, 1); // turn OFF both left side lights
624  MainRingFlash(ALL, 0, 1, 0); // FlashPattern (OFF, DIAMOND, BOX, POINTUP, POINTDWN, ALL); OnTime, OffTime; Randomize (0=OFF : 1=ON) )
625 
626  BottomLEDChase(20);
629  RearTopLED (REAR_BI_LED_TOP_PIN, 300, 1000);
630 
631  if (SplitBounceTopLED(RED, 15)==1)
632  {
633 // SequenceTwoTime = 0;
634 // SequenceTwoState++;
635  RightSideLEDTime = 1; // I need this to be able to instantly turn (pre-load counter) on the Side LEDs
636  LeftSideLEDTime = 1;
638  RightSideLEDTime = 0;
639  LeftSideLEDOnState = 0;
640  LeftSideLEDTime = 0;
641  RightSideLED(FRONT_RED, BACK_RED, 1, 0); // turn on both right side lights to White
642  LeftSideLED (FRONT_RED, BACK_RED, 1, 0); // turn on both left side lights
643  BottomLEDFlashTime = 1;
644  BottomLEDFlash(ALL, 1, 0, 0);
645  delay(400);
646  }
647  break;
648  }
649  }
650 }
651 
652 
653 
654 //**************************************************************************************************************************************************************************
655 //**************************************************************************************************************************************************************************
656 //
657 // ObiWan: This function combines other functions to enable a flashing blue light sequence
658 //
659 //
660 
661 void ObiWan(int Rate)
662 {
663  switch (SequenceThreeState)
664  {
665  case 0: // FADE OUT
666  {
667  MainRingFlash(0b00000000, 80, 0, 1); // FlashPattern (OFF, DIAMOND, BOX, POINTUP, POINTDWN, ALL); OnTime, OffTime; Randomize (0=OFF : 1=ON) )
668 
669  RightSideLED(FRONT_BLUE, BACK_BLUE, 1, 0); // turn on both right side lights to White
670  LeftSideLED(FRONT_BLUE, BACK_BLUE, 1, 0); // turn on both left side lights to White
671 
672  RadiateTopLED(BLUE, 10);
673  BottomLEDChase(20);
676  RearTopLED (REAR_BI_LED_TOP_PIN, 300, 1000);
677  if (SequenceThreeTime++ > random(80, 160)*Rate)
678  {
679  SequenceThreeTime = 0;
681  }
682  break;
683  }
684  case 1: // OFF
685  {
686  MainRingFlash(0b00000000, 80, 0, 1); // FlashPattern (OFF, DIAMOND, BOX, POINTUP, POINTDWN, ALL); OnTime, OffTime; Randomize (0=OFF : 1=ON) )
687 
688  RightSideLED(FRONT_BLUE, BACK_BLUE, 0, 1); // turn on both right side lights to White
689  LeftSideLED(FRONT_BLUE, BACK_BLUE, 0, 1); // turn on both left side lights to White
690 
691  RadiateTopLED(BLUE, 10);
692  BottomLEDChase(20);
695  RearTopLED (REAR_BI_LED_TOP_PIN, 300, 1000);
696  if (SequenceThreeTime++ > Rate)
697  {
698  SequenceThreeTime = 0;
700  }
701  break;
702  }
703  case 2: // FADE IN
704  {
705  MainRingFlash(0b00000000, 80, 0, 1); // FlashPattern (OFF, DIAMOND, BOX, POINTUP, POINTDWN, ALL); OnTime, OffTime; Randomize (0=OFF : 1=ON) )
706 
707  RightSideLED(FRONT_BLUE, BACK_BLUE, 1, 0); // turn on both right side lights to White
708  LeftSideLED(FRONT_BLUE, BACK_BLUE, 1, 0); // turn on both left side lights to White
709 
710  RadiateTopLED(BLUE, 10);
711  BottomLEDChase(20);
714  RearTopLED (REAR_BI_LED_TOP_PIN, 300, 1000);
715  if (SequenceThreeTime++ > Rate)
716  {
717  SequenceThreeTime = 0;
719  }
720  break;
721  }
722  case 3: // FADE IN
723  {
724  MainRingFlash(0b00000000, 80, 0, 1); // FlashPattern (OFF, DIAMOND, BOX, POINTUP, POINTDWN, ALL); OnTime, OffTime; Randomize (0=OFF : 1=ON) )
725 
726  RightSideLED(FRONT_BLUE, BACK_BLUE, 0, 1); // turn on both right side lights to White
727  LeftSideLED(FRONT_BLUE, BACK_BLUE, 0, 1); // turn on both left side lights to White
728 
729  RadiateTopLED(BLUE, 10);
730  BottomLEDChase(20);
733  RearTopLED (REAR_BI_LED_TOP_PIN, 300, 1000);
734  if (SequenceThreeTime++ > Rate)
735  {
736  SequenceThreeTime = 0;
738  }
739  break;
740  }
741  case 4: // FADE IN
742  {
743  MainRingFlash(0b00000000, 80, 0, 1); // FlashPattern (OFF, DIAMOND, BOX, POINTUP, POINTDWN, ALL); OnTime, OffTime; Randomize (0=OFF : 1=ON) )
744 
745  RightSideLED(FRONT_BLUE, BACK_BLUE, 1, 0); // turn on both right side lights to White
746  LeftSideLED(FRONT_BLUE, BACK_BLUE, 1, 0); // turn on both left side lights to White
747 
748  RadiateTopLED(BLUE, 10);
749  BottomLEDChase(20);
752  RearTopLED (REAR_BI_LED_TOP_PIN, 300, 1000);
753  if (SequenceThreeTime++ > 2*Rate)
754  {
755  SequenceThreeTime = 0;
757  }
758  break;
759  }
760  case 5: // FADE IN
761  {
762  MainRingFlash(0b00000000, 80, 0, 1); // FlashPattern (OFF, DIAMOND, BOX, POINTUP, POINTDWN, ALL); OnTime, OffTime; Randomize (0=OFF : 1=ON) )
763 
764  RightSideLED(FRONT_BLUE, BACK_BLUE, 0, 1); // turn on both right side lights to White
765  LeftSideLED(FRONT_BLUE, BACK_BLUE, 0, 1); // turn on both left side lights to White
766 
767  RadiateTopLED(BLUE, 10);
768  BottomLEDChase(20);
771  RearTopLED (REAR_BI_LED_TOP_PIN, 300, 1000);
772  if (SequenceThreeTime++ > Rate*2)
773  {
774  SequenceThreeTime = 0;
776  }
777  break;
778  }
779  }
780 }
781 
782 //**************************************************************************************************************************************************************************
783 //**************************************************************************************************************************************************************************
784 //
785 // Yoda: This function combines functions to enable a glowing green light sequence
786 //
787 //
788 
789 void Yoda(int Rate)
790 {
791  switch (SequenceFourState)
792  {
793  case 0: // FADE OUT
794  {
795  MainRingFlash(ALL, 0, 1, 0); // FlashPattern (OFF, DIAMOND, BOX, POINTUP, POINTDWN, ALL); OnTime, OffTime; Randomize (0=OFF : 1=ON) )
796  RightSideLED(FRONT_GREEN, BACK_GREEN, 1, 0); // turn on both right side lights to White
797  LeftSideLED(FRONT_GREEN, BACK_GREEN, 1, 0); // turn on both left side lights to White
798  FlashTopLED(0b11111111, GREEN, 1, 0, 0); // turn on all top lights to white
799  BottomLEDChase(20);
802  RearTopLED (REAR_BI_LED_TOP_PIN, 300, 1000);
803  if (SequenceFourTime++ > Rate/25)
804  {
805  Brightness--;
806  lc.setIntensity(0,Brightness); // 0 = dim, 15 = full brightness
807  SequenceFourTime = 0;
808  if (Brightness < 1)
809  {
811  }
812  }
813  break;
814  }
815 
816  case 1: // OFF
817  {
818  MainRingFlash(ALL, 0, 1, 0); // FlashPattern (OFF, DIAMOND, BOX, POINTUP, POINTDWN, ALL); OnTime, OffTime; Randomize (0=OFF : 1=ON) )
819  RightSideLED(FRONT_GREEN, BACK_GREEN, 0, 1); // turn on both right side lights to White
820  LeftSideLED(FRONT_GREEN, BACK_GREEN, 0, 1); // turn on both left side lights to White
821  FlashTopLED(0b11111111, GREEN, 0, 1, 0); // turn on all top lights to white
822  BottomLEDChase(20);
825  RearTopLED (REAR_BI_LED_TOP_PIN, 300, 1000);
826  if (SequenceFourTime++ > Rate)
827  {
828  lc.setIntensity(0,0);
829  SequenceFourTime = 0;
831  }
832  else if (SequenceFourTime > 5)
833  {
834  lc.setIntensity(0,15);
835  }
836  break;
837  }
838 
839  case 2: // FADE IN
840  {
841  MainRingFlash(ALL, 0, 1, 0); // FlashPattern (OFF, DIAMOND, BOX, POINTUP, POINTDWN, ALL); OnTime, OffTime; Randomize (0=OFF : 1=ON) )
842  RightSideLED(FRONT_GREEN, BACK_GREEN, 1, 0); // turn on both right side lights to White
843  LeftSideLED(FRONT_GREEN, BACK_GREEN, 1, 0); // turn on both left side lights to White
844  FlashTopLED(0b11111111, GREEN, 1, 0, 0); // turn on all top lights to white
845  BottomLEDChase(20);
848  RearTopLED (REAR_BI_LED_TOP_PIN, 300, 1000);
849  if (SequenceFourTime++ > Rate/25)
850  {
851  Brightness++;
852  lc.setIntensity(0,Brightness); // 0 = dim, 15 = full brightness
853  SequenceFourTime = 0;
854  if (Brightness > 14)
855  {
857  }
858  }
859  break;
860  }
861  }
862 }
863 
864 //**************************************************************************************************************************************************************************
865 //**************************************************************************************************************************************************************************
866 //
867 // SearchLight: This function combines functions to turn on All of the White LEDs
868 //
869 //
870 
871  void SearchLight()
872 {
873  RightSideLED(FRONT_WHITE, BACK_WHITE, 0, 1); // (Pattern: LOCATION (FRONT, BACK, BOTH) and COLOR - i.e. BACK_GREEN, or BOTH WHITE, OnTime, OffTime)
874  LeftSideLED (FRONT_WHITE, BACK_WHITE, 0, 1); // Note - WHITE is TOP or BOTTOM not FRONT/BACK. i.e. TOP_WHITE or BOTH_WHITE
875  FlashTopLED(0b11111111, WHITE, 0, 1, 0); // turn on all top lights to white
876 
877  BigLED(1, 0); // turn on BIG LED
878  MainRingFlash(ALL, 1, 0, 0); // FlashPattern (OFF, DIAMOND, BOX, POINTUP, POINTDWN, ALL); OnTime, OffTime; Randomize (0=OFF : 1=ON) )
879 
880  BottomLEDChase(20);
883  RearTopLED (REAR_BI_LED_TOP_PIN, 300, 1000);
884 }
885 
886 
887 //**************************************************************************************************************************************************************************
888 //**************************************************************************************************************************************************************************
889 //
890 // Sparkle: This function combines the 85 Lumen LED and the 8 white center LEDs, along with an option to enable the side RGB LEDs
891 //
892 // mode: 1= side LEDs are enabled 0= side LEDs turned off
893 //
894 
895 
896 void Sparkle(byte mode) // Sequence 6
897 {
898  switch (SequenceSixState)
899  {
900  case 0: //
901  {
902  MainRingFlash(ALL, 1, 5, 1); // FlashPattern (OFF, DIAMOND, BOX, POINTUP, POINTDWN, ALL); OnTime, OffTime; Randomize (0=OFF : 1=ON) )
903  BigLED(1, random(25,250)); // turn on BIG LED
904  BottomLEDChase(20);
907  RearTopLED (REAR_BI_LED_TOP_PIN, 300, 1000);
908 
909  if(mode) // only enable side and top leds if mode is 1, this way Sparkle can be used for just the main light area
910  {
911  RightSideLED(FRONT_WHITE, BACK_WHITE, 2, 17); // (Pattern: LOCATION (FRONT, BACK, BOTH) and COLOR - i.e. BACK_GREEN, or BOTH WHITE, OnTime, OffTime)
912  LeftSideLED (FRONT_WHITE, BACK_WHITE, 3, 16); // Note - WHITE is TOP or BOTTOM not FRONT/BACK. i.e. TOP_WHITE or BOTH_WHITE
913  FlashTopLED(0b11111111, WHITE, 2, 13, 1); // turn on all top lights to white
914  }
915  break;
916  }
917  }//end switch
918 }//end FullCycle()
919 
920 
921 //**************************************************************************************************************************************************************************
922 //**************************************************************************************************************************************************************************
923 //
924 // RightSideLED: This function controls the two RGB LEDs on the Right side of the periscope
925 // Each RGB LED color can be individually selected for more color options
926 //
927 // Pattern: See the "SIDE LED BIT PATTERN:" Colors listed at the beginning of this code (in the #define list)
928 // Pattern2:
929 // OnTime: How long the LEDs are ON
930 // OffTime: How long the LEDs are OFF
931 
932 void RightSideLED(byte Pattern, byte Pattern2, byte OnTime, byte OffTime)
933 {
934  Pattern = Pattern | Pattern2;
935 
936  if (RightSideLEDOnState) // Toggle : The LED is ON and NOT Disabled (OFFTime is not 0)
937  {
938  if (RightSideLEDTime++ >= OnTime) // wait to turn OFF LED
939  {
940  RightSideLEDTime = 0;
941  if (OffTime) // do not turn off the LED's if OffTime = 0
942  {
943  lc.setRow(0, RIGHT, 0b00000000); // All Off
944  }
946  }
947  }
948  else // Toggle : The LED is OFF
949  {
950  if (RightSideLEDTime++ >= OffTime) // wait to turn On LED
951  {
952  RightSideLEDTime = 0;
953  if (OnTime) // do not turn off the LED's if OffTime = 0
954  {
955  lc.setRow(0, RIGHT, Pattern); // All Off
956  }
958  }
959  }
960 }
961 
962 //**************************************************************************************************************************************************************************
963 //**************************************************************************************************************************************************************************
964 //
965 // LeftSideLED: This function controls the two RGB LEDs on the Left side of the periscope
966 // Each RGB LED color can be individually selected for more color options
967 //
968 // Pattern: See the "SIDE LED BIT PATTERN:" Colors listed at the beginning of this code (in the #define list)
969 // Pattern2:
970 // OnTime: How long the LEDs are ON
971 // OffTime: How long the LEDs are OFF
972 
973 
974 void LeftSideLED(byte Pattern, byte Pattern2, byte OnTime, byte OffTime)
975 {
976  Pattern = Pattern | Pattern2;
977  if (LeftSideLEDOnState) // Toggle : The LED is ON and NOT Disabled (OFFTime is not 0)
978  {
979  if (LeftSideLEDTime++ >= OnTime) // wait to turn OFF LED
980  {
981  LeftSideLEDTime = 0;
982  if (OffTime) // do not turn off the LED's if OffTime = 0
983  {
984  lc.setRow(0, LEFT, 0b00000000); // All Off
985  }
986  LeftSideLEDOnState = 0;
987  }
988  }
989  else // Toggle : The LED is OFF
990  {
991  if (LeftSideLEDTime++ >= OffTime) // wait to turn On LED /////////////////////////
992  {
993  LeftSideLEDTime = 0;
994  if (OnTime) // do not turn off the LED's if OffTime = 0
995  {
996  lc.setRow(0, LEFT, Pattern); // All Off
997  }
998  LeftSideLEDOnState = 1;
999  }
1000  }
1001 }
1002 
1003 
1004 //**************************************************************************************************************************************************************************
1005 //**************************************************************************************************************************************************************************
1006 //
1007 // RearSingleLED: This function turns On and Off the Rear LED that is on the side with one single LED
1008 //
1009 // Pattern: PATTERN FOR REAR LED CONTROL (ALLOWS FOR ENABLING BI-COLOR LEDS - NOT INCUDED IN KIT)
1010 // REAR_BI_LED_TOP_PIN 0 // THIS CONTROLS THE REAR LED THAT IS SOLDERED TO THE TOP PIN LOCATION ON THE PCB (DEFAULT FOR NON BICOLOR LEDs)
1011 // REAR_BI_LED_BOT_PIN 1 // THIS CONTROLS THE REAR LED THAT IS SOLDERED TO THE BOTTOM PIN LOCATION ON THE PCB (NOT CONNECTED IN KITS)
1012 // REAR_BI_LED_BOTH 2 // THIS CONTROLS BOTH PINS OF A BI-COLOR LED
1013 // OnTime: How long the LED is on
1014 // OffTime: How long the LED is off
1015 
1016 
1017 void RearSingleLED (byte Pattern, byte OnTime, byte OffTime)
1018 {
1019  if (RearSingleLEDOnState) // Toggle : The LED is ON and NOT Disabled (OFFTime is not 0)
1020  {
1021  if (RearSingleLEDFlashTime++ >= OnTime) // wait to turn OFF LED
1022  {
1024  if (OffTime) // do not turn off the LED's if OffTime = 0
1025  {
1026  if(Pattern == 0) // change top bi-color LED pin (default)
1027  {
1028  lc.setLed(0, REAR, 0, false); // TURN OFF
1029  }
1030  else if(Pattern == 1) // change bottom bi-color LED pin (bicolor leds are not included in kit)
1031  {
1032  lc.setLed(0, REAR, 1, false); // TURN OFF
1033  }
1034  else //(Pattern == 2) // change both bi-color LED pins (bicolor leds are not included in kit)
1035  {
1036  lc.setLed(0, REAR, 0, false); // TURN OFF
1037  lc.setLed(0, REAR, 1, false); // TURN OFF
1038  }
1039  }
1041  }
1042  }
1043  else // Toggle : The LED is OFF
1044  {
1045  if (RearSingleLEDFlashTime++ >= OffTime) // wait to turn On LED
1046  {
1048  if (OnTime) // do not turn off the LED's if OffTime = 0
1049  {
1050  if(Pattern == 0) // change top bi-color LED pin (default)
1051  {
1052  lc.setLed(0, REAR, 0, true); // TURN ON
1053  }
1054  else if(Pattern == 1) // change bottom bi-color LED pin (bicolor leds are not included in kit)
1055  {
1056  lc.setLed(0, REAR, 1, true); // TURN ON
1057  }
1058  else //(Pattern == 2) // change both bi-color LED pins (bicolor leds are not included in kit)
1059  {
1060  lc.setLed(0, REAR, 0, true); // TURN ON
1061  lc.setLed(0, REAR, 1, true); // TURN ON
1062  }
1063  }
1065  }
1066  }
1067 }
1068 
1069 
1070 //**************************************************************************************************************************************************************************
1071 //**************************************************************************************************************************************************************************
1072 //
1073 // RearTopLED: This function turns On and Off one of the Rear LEDs (the top LED of the two rear LEDs)
1074 //
1075 //
1076 // Pattern: PATTERN FOR REAR LED CONTROL (ALLOWS FOR ENABLING BI-COLOR LEDS - NOT INCUDED IN KIT)
1077 // REAR_BI_LED_TOP_PIN 0 // THIS CONTROLS THE REAR LED THAT IS SOLDERED TO THE TOP PIN LOCATION ON THE PCB (DEFAULT FOR NON BICOLOR LEDs)
1078 // REAR_BI_LED_BOT_PIN 1 // THIS CONTROLS THE REAR LED THAT IS SOLDERED TO THE BOTTOM PIN LOCATION ON THE PCB (NOT CONNECTED IN KITS)
1079 // REAR_BI_LED_BOTH 2 // THIS CONTROLS BOTH PINS OF A BI-COLOR LED
1080 // OnTime: How long the LED is on
1081 // OffTime: How long the LED is off
1082 
1083 
1084 void RearTopLED (byte Pattern, byte OnTime, byte OffTime)
1085 {
1086  if (RearTopLEDOnState) // Toggle : The LED is ON and NOT Disabled (OFFTime is not 0)
1087  {
1088  if (RearTopLEDFlashTime++ >= OnTime) // wait to turn OFF LED
1089  {
1090  RearTopLEDFlashTime = 0;
1091  if (OffTime) // do not turn off the LED's if OffTime = 0
1092  {
1093  if(Pattern == 0) // change top bi-color LED pin (default)
1094  {
1095  lc.setLed(0, REAR, 2, false); // TURN OFF
1096  }
1097  else if(Pattern == 1) // change bottom bi-color LED pin (bicolor leds are not included in kit)
1098  {
1099  lc.setLed(0, REAR, 3, false); // TURN OFF
1100  }
1101  else //(Pattern == 2) // change both bi-color LED pins (bicolor leds are not included in kit)
1102  {
1103  lc.setLed(0, REAR, 2, false); // TURN OFF
1104  lc.setLed(0, REAR, 3, false); // TURN OFF
1105  }
1106  }
1107  RearTopLEDOnState = 0;
1108  }
1109  }
1110  else // Toggle : The LED is OFF
1111  {
1112  if (RearTopLEDFlashTime++ >= OffTime) // wait to turn On LED
1113  {
1114  RearTopLEDFlashTime = 0;
1115  if (OnTime) // do not turn off the LED's if OffTime = 0
1116  {
1117  if(Pattern == 0) // change top bi-color LED pin (default)
1118  {
1119  lc.setLed(0, REAR, 2, true); // TURN ON
1120  }
1121  else if(Pattern == 1) // change bottom bi-color LED pin (bicolor leds are not included in kit)
1122  {
1123  lc.setLed(0, REAR, 3, true); // TURN ON
1124  }
1125  else //(Pattern == 2) // change both bi-color LED pins (bicolor leds are not included in kit)
1126  {
1127  lc.setLed(0, REAR, 2, true); // TURN ON
1128  lc.setLed(0, REAR, 3, true); // TURN ON
1129  } }
1130  RearTopLEDOnState = 1;
1131  }
1132  }
1133 }
1134 
1135 
1136 //**************************************************************************************************************************************************************************
1137 //**************************************************************************************************************************************************************************
1138 //
1139 // RearBottomLED: This function turns On and Off one of the Rear LEDs (the lower LED of the two rear LEDs)
1140 //
1141 //
1142 // Pattern: PATTERN FOR REAR LED CONTROL (ALLOWS FOR ENABLING BI-COLOR LEDS - NOT INCUDED IN KIT)
1143 // REAR_BI_LED_TOP_PIN 0 // THIS CONTROLS THE REAR LED THAT IS SOLDERED TO THE TOP PIN LOCATION ON THE PCB (DEFAULT FOR NON BICOLOR LEDs)
1144 // REAR_BI_LED_BOT_PIN 1 // THIS CONTROLS THE REAR LED THAT IS SOLDERED TO THE BOTTOM PIN LOCATION ON THE PCB (NOT CONNECTED IN KITS)
1145 // REAR_BI_LED_BOTH 2 // THIS CONTROLS BOTH PINS OF A BI-COLOR LED
1146 // OnTime: How long the LED is on
1147 // OffTime: How long the LED is off
1148 
1149 
1150 void RearBottomLED (byte Pattern, byte OnTime, byte OffTime)
1151 {
1152  if (RearBottomLEDOnState) // Toggle : The LED is ON and NOT Disabled (OFFTime is not 0)
1153  {
1154  if (RearBottomLEDFlashTime++ >= OnTime) // wait to turn OFF LED
1155  {
1157  if (OffTime) // do not turn off the LED's if OffTime = 0
1158  {
1159  if(Pattern == 0) // change top bi-color LED pin (default)
1160  {
1161  lc.setLed(0, REAR, 4, false); // TURN OFF
1162  }
1163  else if(Pattern == 1) // change bottom bi-color LED pin (bicolor leds are not included in kit)
1164  {
1165  lc.setLed(0, REAR, 5, false); // TURN OFF
1166  }
1167  else //(Pattern == 2) // change both bi-color LED pins (bicolor leds are not included in kit)
1168  {
1169  lc.setLed(0, REAR, 4, false); // TURN OFF
1170  lc.setLed(0, REAR, 5, false); // TURN OFF
1171  }
1172  }
1174  }
1175  }
1176  else // Toggle : The LED is OFF
1177  {
1178  if (RearBottomLEDFlashTime++ >= OffTime) // wait to turn On LED
1179  {
1181  if (OnTime) // do not turn off the LED's if OffTime = 0
1182  {
1183  if(Pattern == 0) // change top bi-color LED pin (default)
1184  {
1185  lc.setLed(0, REAR, 4, true); // TURN ON
1186  }
1187  else if(Pattern == 1) // change bottom bi-color LED pin (bicolor leds are not included in kit)
1188  {
1189  lc.setLed(0, REAR, 5, true); // TURN ON
1190  }
1191  else //(Pattern == 2) // change both bi-color LED pins (bicolor leds are not included in kit)
1192  {
1193  lc.setLed(0, REAR, 4, true); // TURN ON
1194  lc.setLed(0, REAR, 5, true); // TURN ON
1195  } }
1197  }
1198  }
1199 }
1200 
1201 
1202 //**************************************************************************************************************************************************************************
1203 //**************************************************************************************************************************************************************************
1204 //
1205 // BounceTopLED: This function lights one Top Led at a time as it bounces from side to side
1206 //
1207 // Color: (0 to 6)
1208 // RED 0
1209 // GREEN 1
1210 // BLUE 2
1211 // MAGENTA 3
1212 // CYAN 4
1213 // YELLOW 5
1214 // WHITE 6
1215 //
1216 // Rate: Speed
1217 //
1218 //
1219 // Returns a True (1) value when one cycle has completed - to allow a color change...
1220 //
1221 
1222 
1223 byte BounceTopLED(byte Color, byte Rate)
1224 {
1225  switch (BounceTopLEDstate)
1226  {
1227  case 0: // Setup and Begin Decrement - Start at left - Turn on 1st LED
1228  {
1229  if (TopTime++ > Rate)
1230  {
1231  TopTime = 0;
1232  SetTopLed(0,WHITE,Top_Position,false); // Turn off last LED
1233  Top_Position = 6;
1234  SetTopLed(0, Color, Top_Position, true); // Turn on 1st LED
1236  }
1237  break;
1238  }
1239  case 1: // Decrement LED Position
1240  {
1241  if (TopTime++ > Rate) // 1 Seconds
1242  {
1243  TopTime = 0;
1244  SetTopLed(0,WHITE,Top_Position,false); // Turn off last LED
1245  Top_Position--;
1246  SetTopLed(0,Color,Top_Position,true); // Turn on next LED
1247 // if (Top_Position == 3){return 0;}
1248  if(Top_Position < 1)
1250  }
1251  break;
1252  }
1253  case 2: // Decrement LED Position
1254  {
1255  if (TopTime++ > Rate) // 1 Seconds
1256  {
1257  TopTime = 0;
1258  SetTopLed(0,WHITE,Top_Position,false); // Turn off last LED
1259  Top_Position++;
1260  SetTopLed(0,Color,Top_Position,true); // Turn on next LED
1261  if(Top_Position > 5)
1262  {
1264  return 1;
1265  }
1266  }
1267  break;
1268  }
1269  }
1270  return 0;
1271 }
1272 
1273 
1274 
1275 
1276 //**************************************************************************************************************************************************************************
1277 //***********************************************************************************************************************************************************************
1278 //
1279 // SplitBounceTopLED: This function will bounce two LEDs across the Top Seven LEDs. The Top Center LED turns on first, then the LEDs move outward, and then "bounce" back to the center.
1280 //
1281 // Color: (0 to 6)
1282 // RED 0
1283 // GREEN 1
1284 // BLUE 2
1285 // MAGENTA 3
1286 // CYAN 4
1287 // YELLOW 5
1288 // WHITE 6
1289 //
1290 // Rate: Speed
1291 //
1292 //
1293 // Return a 2 when lights meet at center, Return a 1 when lights are at outer edges
1294 //
1295 
1296 byte SplitBounceTopLED(byte Color, byte Rate) // Return a 2 when lights meet at center, Return a 1 when lights are at outer edges
1297 {
1298  switch (SplitBounceTopLEDstate)
1299  {
1300  case 0: // Setup and Begin Decrement - Start at left - Turn on 1st LED
1301  {
1302  if (SplitTopTime++ > Rate)
1303  {
1304  SplitTopTime = 0;
1305  SetTopLed(0,Color,2,false); // Turn off last LED
1306  SetTopLed(0,Color,4,false); // Turn off last LED
1307 
1308  SetTopLed(0, Color, 3, true); // Turn on 1st LED
1310  }
1311  break;
1312  }
1313  case 1: //
1314  {
1315  if (SplitTopTime++ > Rate) // 1 Seconds
1316  {
1317  SplitTopTime = 0;
1318  SetTopLed(0,Color,3,false); // Turn off last LED
1319  SetTopLed(0,Color,2,true); // Turn on next LED
1320  SetTopLed(0,Color,4,true); // Turn on next LED
1322  }
1323  break;
1324  }
1325  case 2: // Decrement LED Position
1326  {
1327  if (SplitTopTime++ > Rate) // 1 Seconds
1328  {
1329  SplitTopTime = 0;
1330  SetTopLed(0,Color,2,false); // Turn off last LED
1331  SetTopLed(0,Color,4,false); // Turn off last LED
1332  SetTopLed(0,Color,1,true); // Turn on next LED
1333  SetTopLed(0,Color,5,true); // Turn on next LED
1335  }
1336  break;
1337  }
1338  case 3: // Decrement LED Position
1339  {
1340  if (SplitTopTime++ > Rate) // 1 Seconds
1341  {
1342  SplitTopTime = 0;
1343  SetTopLed(0,Color,1,false); // Turn off last LED
1344  SetTopLed(0,Color,5,false); // Turn off last LED
1345  SetTopLed(0,Color,0,true); // Turn on next LED
1346  SetTopLed(0,Color,6,true); // Turn on next LED
1348  return 1;
1349  }
1350  break;
1351  }
1352  case 4: // Decrement LED Position
1353  {
1354  if (SplitTopTime++ > Rate) // 1 Seconds
1355  {
1356  SplitTopTime = 0;
1357  SetTopLed(0,Color,0,false); // Turn off last LED
1358  SetTopLed(0,Color,6,false); // Turn off last LED
1359  SetTopLed(0,Color,1,true); // Turn on next LED
1360  SetTopLed(0,Color,5,true); // Turn on next LED
1362  //return 1;
1363  }
1364  break;
1365  }
1366  case 5: // Decrement LED Position
1367  {
1368  if (SplitTopTime++ > Rate) // 1 Seconds
1369  {
1370  SplitTopTime = 0;
1371  SetTopLed(0,Color,1,false); // Turn off last LED
1372  SetTopLed(0,Color,5,false); // Turn off last LED
1373  SetTopLed(0,Color,2,true); // Turn on next LED
1374  SetTopLed(0,Color,4,true); // Turn on next LED
1376  // return 2;
1377  }
1378  break;
1379  }
1380  }
1381  return 0;
1382 }
1383 
1384 //**************************************************************************************************************************************************************************
1385 //**************************************************************************************************************************************************************************
1386 //
1387 // RadiateTopLED: This function will "radiate" the top LEDs. The Top Center LED turns on first, then the LEDs move outward, and then turn off as they move back to the center.
1388 //
1389 // Color: (0 to 6)
1390 // RED 0
1391 // GREEN 1
1392 // BLUE 2
1393 // MAGENTA 3
1394 // CYAN 4
1395 // YELLOW 5
1396 // WHITE 6
1397 //
1398 // Rate: Speed
1399 //
1400 //
1401 // Returns a True (1) value when one cycle has completed - to allow a color change...
1402 //
1403 
1404 
1405 byte RadiateTopLED(byte Color, byte Rate)
1406 {
1407  switch (RadiateTopLEDstate)
1408  {
1409  case 0: // Setup and Begin Decrement - Start at left - Turn on 1st LED
1410  {
1411  if (RadiateTopTime++ > Rate)
1412  {
1413  RadiateTopTime = 0;
1414  SetTopLed(0,WHITE,2,false); // Turn off last LED
1415  SetTopLed(0,WHITE,4,false); // Turn off last LED
1416 
1417  SetTopLed(0, Color, 3, true); // Turn on 1st LED
1419  }
1420  break;
1421  }
1422  case 1: //
1423  {
1424  if (RadiateTopTime++ > Rate) // 1 Seconds
1425  {
1426  RadiateTopTime = 0;
1427  // SetTopLed(0,Color,3,false); // Turn off last LED
1428  SetTopLed(0,Color,2,true); // Turn on next LED
1429  SetTopLed(0,Color,4,true); // Turn on next LED
1431  }
1432  break;
1433  }
1434  case 2: // Decrement LED Position
1435  {
1436  if (RadiateTopTime++ > Rate) // 1 Seconds
1437  {
1438  RadiateTopTime = 0;
1439  // SetTopLed(0,Color,2,false); // Turn off last LED
1440  // SetTopLed(0,Color,4,false); // Turn off last LED
1441  SetTopLed(0,Color,1,true); // Turn on next LED
1442  SetTopLed(0,Color,5,true); // Turn on next LED
1444  }
1445  break;
1446  }
1447  case 3: // Decrement LED Position
1448  {
1449  if (RadiateTopTime++ > Rate) // 1 Seconds
1450  {
1451  RadiateTopTime = 0;
1452 // SetTopLed(0,Color,1,false); // Turn off last LED
1453 // SetTopLed(0,Color,5,false); // Turn off last LED
1454  SetTopLed(0,Color,0,true); // Turn on next LED
1455  SetTopLed(0,Color,6,true); // Turn on next LED
1457  }
1458  break;
1459  }
1460  case 4: // Decrement LED Position
1461  {
1462  if (RadiateTopTime++ > Rate) // 1 Seconds
1463  {
1464  RadiateTopTime = 0;
1465  SetTopLed(0,WHITE,0,false); // Turn off last LED
1466  SetTopLed(0,WHITE,6,false); // Turn off last LED
1467  SetTopLed(0,Color,1,true); // Turn on next LED
1468  SetTopLed(0,Color,5,true); // Turn on next LED
1470  }
1471  break;
1472  }
1473  case 5: // Decrement LED Position
1474  {
1475  if (RadiateTopTime++ > Rate) // 1 Seconds
1476  {
1477  RadiateTopTime = 0;
1478  SetTopLed(0,WHITE,1,false); // Turn off last LED
1479  SetTopLed(0,WHITE,5,false); // Turn off last LED
1480  SetTopLed(0,Color,2,true); // Turn on next LED
1481  SetTopLed(0,Color,4,true); // Turn on next LED
1483  }
1484  break;
1485  }
1486  case 6: // Setup and Begin Decrement - Start at left - Turn on 1st LED
1487  {
1488  if (RadiateTopTime++ > Rate)
1489  {
1490  RadiateTopTime = 0;
1491  SetTopLed(0,WHITE,2,false); // Turn off last LED
1492  SetTopLed(0,WHITE,4,false); // Turn off last LED
1493 
1494  SetTopLed(0, Color, 3, true); // Turn on 1st LED
1496  }
1497  break;
1498  }
1499  case 7: // Setup and Begin Decrement - Start at left - Turn on 1st LED
1500  {
1501  if (RadiateTopTime++ > Rate)
1502  {
1503  RadiateTopTime = 0;
1504  // SetTopLed(0,Color,2,false); // Turn off last LED
1505  // SetTopLed(0,Color,4,false); // Turn off last LED
1506 
1507  SetTopLed(0, WHITE, 3, false); // Turn on 1st LED
1509  return 1;
1510  }
1511  break;
1512  }
1513  }
1514  return 0;
1515 }
1516 
1517 
1518 //**************************************************************************************************************************************************************************
1519 //**************************************************************************************************************************************************************************
1520 //
1521 // FlashTopLED: This Flashes a pattern on the 7 RGB LEDs along the top of the perisope housing
1522 //
1523 // FlashPattern: 0b01234567 : 7 is NOT used and 0 is the Left
1524 // TOP LED: o o o o o o o
1525 // Value 0b . . . . . . . X
1526 //
1527 // Color: (0 to 6)
1528 // RED 0
1529 // GREEN 1
1530 // BLUE 2
1531 // MAGENTA 3
1532 // CYAN 4
1533 // YELLOW 5
1534 // WHITE 6
1535 //
1536 // OnTime: How long the LEDs are ON
1537 // OffTime: How long the LEDs are OFF
1538 // Random: 1 = Random Pattern Selection 0 = Use FlashPattern
1539 
1540 
1541 void FlashTopLED(byte FlashPattern, byte Color, byte OnTime, byte OffTime, byte Random)
1542 {
1543  if (FlashTopLEDOnState)// & OffTime) // Toggle : The LED is ON and NOT Disabled (OFFTime is not 0)
1544  {
1545  if (TopFlashTime++ >= OnTime) // wait to turn OFF LED
1546  {
1547  TopFlashTime = 0;
1548  if (OffTime) // do not turn off the LED's if OffTime = 0
1549  {
1550  SetTopRow(0, WHITE, 0b00000000); // Use White to turn OFF ALL signal lines (RGB)
1551  }
1552  FlashTopLEDOnState = 0;
1553  }
1554  }
1555  else // Toggle : The LED is OFF
1556  {
1557  if (TopFlashTime++ >= OffTime) // wait to turn On LED
1558  {
1559  TopFlashTime = 0;
1560  if (OnTime) // do not turn off the LED's if OffTime = 0
1561  {
1562  if (Random)
1563  {
1564  FlashPattern = random(1, time);
1565  }
1566  SetTopRow(0, Color, FlashPattern); // TURN ON LEDS
1567  }
1568  FlashTopLEDOnState = 1;
1569  }
1570  }
1571 }
1572 
1573 
1574 
1575 //**************************************************************************************************************************************************************************
1576 //**************************************************************************************************************************************************************************
1577 //
1578 // BigLED(int OnTime, int OffTime) This turns on the 85 Lumen Center White LED
1579 //
1580 // OnTime: Time LED is ON
1581 // OffTime: Time LED is OFF
1582 //
1583 
1584 
1585 void BigLED (int OnTime, int OffTime)
1586 {
1587  if (BigLEDOnState) // Toggle : The LED is ON and NOT Disabled (OFFTime is not 0)
1588  {
1589  if (BigLEDFlashTime++ >= OnTime) // wait to turn OFF LED
1590  {
1591  BigLEDFlashTime = 0;
1592  if (OffTime) // do not turn off the LED's if OffTime = 0
1593  {
1594  digitalWrite(5, LOW); // Turn OFF Main LED
1595  }
1596  BigLEDOnState = 0;
1597  }
1598  }
1599  else // Toggle : The LED is OFF
1600  {
1601  if (BigLEDFlashTime++ >= OffTime) // wait to turn On LED
1602  {
1603  BigLEDFlashTime = 0;
1604  if (OnTime) // do not turn off the LED's if OffTime = 0
1605  {
1606  digitalWrite(5, HIGH); // Turn ON Main LED
1607  }
1608  BigLEDOnState = 1;
1609  }
1610  }
1611 }
1612 
1613 
1614 //**************************************************************************************************************************************************************************
1615 //**************************************************************************************************************************************************************************
1616 //
1617 // MainRingFlash(byte FlashPattern, int FlashRate, byte Random);
1618 //
1619 // FlashPattern 0 to 5 (see Patterns Below)
1620 // FlashRate Speed
1621 // Random 0 = OFF 1 = RANDOMIZE the FlashPattern
1622 /*
1623 
1624 
1625  . OFF
1626  X ON
1627 
1628  CUSTOM 0 = ALL OFF 1 = DIAMOND 2 = BOX 3 = POINT UP 4 = POINT DOWN 5 = ALL ON
1629 
1630  0 . X . X . X
1631  7 1 . . . . X X . . X X X X
1632  6 2 . . X X . . . . . . X X
1633  5 3 . . . . X X X X . . X X
1634  4 . X . . X X
1635 
1636 LSB....MSB 0000 0000 0b10101010 0b01010101 0b10010100 0b01001001 1111 1111
1637 
1638 */
1639 
1640 void MainRingFlash (byte FlashPattern, int OnTime, int OffTime, byte Random)
1641 {
1642  if(MainFlashState)
1643  {
1644  if (MainFlashTime++ >= OnTime)
1645  {
1646  MainFlashTime = 0;
1647  if (OffTime) // do not turn off the LED's if OffTime = 0
1648  {
1649  lc.setRow(0, CENTER, OFF);
1650  }
1651  MainFlashState = 0;
1652  }
1653  }
1654  else
1655  {
1656  if (MainFlashTime++ >= OffTime) // wait to turn On LED
1657  {
1658  MainFlashTime = 0;
1659  if (OnTime) // do not turn off the LED's if OffTime = 0
1660  {
1661  if (Random)
1662  {
1663  FlashPattern = random(1, time);
1664  }
1665  lc.setRow(0, CENTER, FlashPattern);
1666  }
1667  MainFlashState = 1;
1668  }
1669  }
1670 } // end of MainRingFlash()
1671 
1672 
1673 //**************************************************************************************************************************************************************************
1674 //**************************************************************************************************************************************************************************
1675 //
1676 // MainRingSpin will Spin a pattern on the 8 White LEDs
1677 //
1678 // SpinNumber: Pattern 1, 2, 3, 4, 5 (see patterns below)
1679 // SpinRate: Speed of the Patttern Spin
1680 // SpinDir: 1 = Clockwise 0 = Counter Clockwise
1681 /*
1682 
1683  . OFF
1684  X ON
1685 
1686 SpinNumber: 1 2 3 4 6
1687 
1688  X X X . X
1689  . . . . . . X X . X
1690  . . . . . . . . . X
1691  . . . . X X X X X X
1692  . X . . X
1693  */
1694 
1695 
1696 void MainRingSpin (byte SpinNumber, int SpinRate, byte SpinDir)
1697 {
1698  switch (SpinNumber)
1699  {
1700  case 1:
1701  {
1702  if (MainSpinTime++ > SpinRate) // 5 Seconds
1703  {
1704  MainSpinTime = 0;
1705  lc.setLed(0,CENTER,center_pos,false); // turn off the last ON position
1706  if(SpinDir) // if ClockWise
1707  {
1708  if (++center_pos > 7)
1709  center_pos = 0;
1710  }
1711  else
1712  {
1713  if (--center_pos < 0)
1714  center_pos = 7;
1715  }
1716  lc.setLed(0,CENTER,center_pos,true); // turn on next LED position
1717  }
1718  break;
1719  }// end of Case 1
1720  case 2: // 2 LEDs ON
1721  {
1722  if (MainSpinTime++ > SpinRate) // 5 Seconds
1723  {
1724  MainSpinTime = 0;
1725  lc.setLed(0,CENTER,center_pos,false); // turn off the last ON position
1726  lc.setLed(0,CENTER,((center_pos + 4) % 8),false); // turn off the last ON position
1727  if(SpinDir) // if ClockWise
1728  {
1729  if (++center_pos > 7)
1730  center_pos = 0;
1731  }
1732  else
1733  {
1734  if (--center_pos < 0)
1735  center_pos = 7;
1736  }
1737  lc.setLed(0,CENTER,center_pos,true); // turn on next LED position
1738  lc.setLed(0,CENTER,((center_pos + 4) % 8),true); // turn off the last ON position
1739  }
1740  break;
1741  } // end of Case 2
1742  case 3: // 3 LEDs ON
1743  {
1744  if (MainSpinTime++ > SpinRate) // 5 Seconds
1745  {
1746  MainSpinTime = 0;
1747  lc.setLed(0,CENTER,center_pos,false); // turn off the last ON position
1748  lc.setLed(0,CENTER,((center_pos + 5) % 8),false); // turn off the last ON position
1749  lc.setLed(0,CENTER,((center_pos + 3) % 8),false); // turn off the last ON position
1750  if(SpinDir) // if ClockWise
1751  {
1752  if (++center_pos > 7)
1753  center_pos = 0;
1754  }
1755  else
1756  {
1757  if (--center_pos < 0)
1758  center_pos = 7;
1759  }
1760  lc.setLed(0,CENTER,center_pos,true); // turn on next LED position
1761  lc.setLed(0,CENTER,((center_pos + 5) % 8),true); // turn off the last ON position
1762  lc.setLed(0,CENTER,((center_pos + 3) % 8),true); // turn off the last ON position
1763  }
1764  break;
1765  } // end of Case 3
1766  case 4: // 4 LEDs ON
1767  {
1768  if (MainSpinTime++ > SpinRate) // 5 Seconds
1769  {
1770  MainSpinTime = 0;
1771  lc.setLed(0,CENTER,center_pos,false); // turn off the last ON position
1772  lc.setLed(0,CENTER,((center_pos + 2) % 8),false); // turn off the last ON position
1773  lc.setLed(0,CENTER,((center_pos + 4) % 8),false); // turn off the last ON position
1774  lc.setLed(0,CENTER,((center_pos + 6) % 8),false); // turn off the last ON position
1775  if(SpinDir) // if ClockWise
1776  {
1777  if (++center_pos > 7)
1778  center_pos = 0;
1779  }
1780  else
1781  {
1782  if (--center_pos < 0)
1783  center_pos = 7;
1784  }
1785  lc.setLed(0,CENTER,center_pos,true); // turn on next LED position
1786  lc.setLed(0,CENTER,((center_pos + 2) % 8),true); // turn off the last ON position
1787  lc.setLed(0,CENTER,((center_pos + 4) % 8),true); // turn off the last ON position
1788  lc.setLed(0,CENTER,((center_pos + 6) % 8),true); // turn off the last ON position
1789  }
1790  break;
1791  } // end of Case 4
1792  case 5: // 5 LEDs ON
1793  {
1794  if (MainSpinTime++ > SpinRate) // 5 Seconds
1795  {
1796  MainSpinTime = 0;
1797  lc.setLed(0,CENTER,center_pos,false); // turn off the last ON position
1798  lc.setLed(0,CENTER,((center_pos + 1) % 8),false); // turn off the last ON position
1799  lc.setLed(0,CENTER,((center_pos + 2) % 8),false); // turn off the last ON position
1800  lc.setLed(0,CENTER,((center_pos + 3) % 8),false); // turn off the last ON position
1801  lc.setLed(0,CENTER,((center_pos + 4) % 8),false); // turn off the last ON position
1802  // lc.setLed(0,CENTER,((center_pos + 5) % 8),false); // turn off the last ON position
1803  if(SpinDir) // if ClockWise
1804  {
1805  if (++center_pos > 7)
1806  center_pos = 0;
1807  }
1808  else
1809  {
1810  if (--center_pos < 0)
1811  center_pos = 7;
1812  }
1813  lc.setLed(0,CENTER,center_pos,true); // turn on next LED position
1814  lc.setLed(0,CENTER,((center_pos + 1) % 8),true); // turn off the last ON position
1815  lc.setLed(0,CENTER,((center_pos + 2) % 8),true); // turn off the last ON position
1816  lc.setLed(0,CENTER,((center_pos + 3) % 8),true); // turn off the last ON position
1817  lc.setLed(0,CENTER,((center_pos + 4) % 8),true); // turn off the last ON position
1818 // lc.setLed(0,CENTER,((center_pos + 5) % 8),true); // turn off the last ON position
1819  }
1820  break;
1821  } // end of Case 5
1822  } // end of SWITCH statement
1823 } // end of MainRingSpin()
1824 
1825 
1826 //***********************************************************************************************************************************************
1827 //***********************************************************************************************************************************************
1828 //
1829 // BottonLEDChase turns on the Red Block LEDs Chase Sequence
1830 //
1831 
1832 void BottomLEDChase(byte Time)
1833 {
1834  switch (BottomLEDChaseState)
1835  {
1836  case 0: // Setup and Begin Increment
1837  {
1838  if (BottomTime++ > Time) // 1 Seconds
1839  {
1840  BottomTime = 0;
1841  Bottom_Position = 0;
1842  lc.setLed(0,BOTTOM,Bottom_Position,true); // Turn on 1st LED
1844  }
1845  break;
1846  }
1847  case 1: // Decrement LED Position
1848  {
1849  if (BottomTime++ > Time) // 1 Seconds
1850  {
1851  BottomTime = 0;
1852  lc.setLed(0,BOTTOM,Bottom_Position,false); // Turn off last LED
1853  Bottom_Position++; // Decrement
1854  lc.setLed(0,BOTTOM,Bottom_Position,true); // Turn on next LED
1855  if(Bottom_Position >= 5)
1857  }
1858  break;
1859  }
1860  case 2: // Change Color to Secondary and Direction to Increment
1861  {
1862  if (BottomTime++ > Time) // 1 Seconds
1863  {
1864  BottomTime = 0;
1865  lc.setLed(0,BOTTOM,Bottom_Position,false); // Turn off last LED
1866  Bottom_Position--; // Change Direction - Increment
1867  lc.setLed(0,BOTTOM,Bottom_Position,true); // Turn on 2nd LED
1868  if(Bottom_Position < 1)
1869  BottomLEDChaseState = 1;
1870  }
1871  break;
1872  }
1873  } // end of Switch Statement
1874 }
1875 
1876 
1877 
1878 //**************************************************************************************************************************************************************************
1879 //**************************************************************************************************************************************************************************
1880 
1882 
1883 void SetTopLed(byte Device, byte Row,byte Col, byte State)
1884 {
1885  switch (Row)
1886  {
1887  case RED:
1888  {
1889  lc.setLed(Device,TOP_RED,Col,State);
1890  lc.setLed(Device,TOP_GREEN,Col,false);
1891  lc.setLed(Device,TOP_BLUE,Col,false);
1892  break;
1893  }
1894  case GREEN:
1895  {
1896  lc.setLed(Device,TOP_RED,Col,false);
1897  lc.setLed(Device,TOP_GREEN,Col,State);
1898  lc.setLed(Device,TOP_BLUE,Col,false);
1899  break;
1900  }
1901  case BLUE:
1902  {
1903  lc.setLed(Device,TOP_RED,Col,false);
1904  lc.setLed(Device,TOP_GREEN,Col,false);
1905  lc.setLed(Device,TOP_BLUE,Col,State);
1906  break;
1907  }
1908  case YELLOW:
1909  {
1910  lc.setLed(Device,TOP_RED,Col,State);
1911  lc.setLed(Device,TOP_GREEN,Col,State);
1912  lc.setLed(Device,TOP_BLUE,Col,false);
1913  break;
1914  }
1915  case MAGENTA:
1916  {
1917  lc.setLed(Device,TOP_RED,Col,State);
1918  lc.setLed(Device,TOP_GREEN,Col,false);
1919  lc.setLed(Device,TOP_BLUE,Col,State);
1920  break;
1921  }
1922  case CYAN:
1923  {
1924  lc.setLed(Device,TOP_RED,Col,false);
1925  lc.setLed(Device,TOP_GREEN,Col,State);
1926  lc.setLed(Device,TOP_BLUE,Col,State);
1927  break;
1928  }
1929  case WHITE:
1930  {
1931  lc.setLed(Device,TOP_RED,Col,State);
1932  lc.setLed(Device,TOP_GREEN,Col,State);
1933  lc.setLed(Device,TOP_BLUE,Col,State);
1934  break;
1935  }
1936  }
1937 }
1938 
1939 
1940 //**************************************************************************************************************************************************************************
1941 //**************************************************************************************************************************************************************************
1942 //
1943 // SetTopRow makes it easy to set the RGB LEDs to the desired color
1944 //
1945 // Device:
1946 // Row:
1947 // Value:
1948 //
1949 // void setRow(int addr, int row, byte value);
1950 
1951 
1952 void SetTopRow(byte Device, byte Row, byte Value)
1953 {
1954  switch (Row)
1955  {
1956  case RED:
1957  {
1958  lc.setRow(Device, TOP_RED, Value);
1959  lc.setRow(Device, TOP_GREEN, false);
1960  lc.setRow(Device, TOP_BLUE, false);
1961  break;
1962  }
1963  case GREEN:
1964  {
1965  lc.setRow(Device, TOP_RED, false);
1966  lc.setRow(Device, TOP_GREEN, Value);
1967  lc.setRow(Device, TOP_BLUE, false);
1968 
1969  break;
1970  }
1971  case BLUE:
1972  {
1973  lc.setRow(Device, TOP_RED, false);
1974  lc.setRow(Device, TOP_GREEN, false);
1975  lc.setRow(Device, TOP_BLUE, Value);
1976 
1977  break;
1978  }
1979  case YELLOW:
1980  {
1981  lc.setRow(Device,TOP_RED,Value);
1982  lc.setRow(Device,TOP_GREEN,Value);
1983  lc.setRow(Device, TOP_BLUE, false);
1984  break;
1985  }
1986  case MAGENTA:
1987  {
1988  lc.setRow(Device,TOP_RED,Value);
1989  lc.setRow(Device, TOP_GREEN, false);
1990  lc.setRow(Device,TOP_BLUE,Value);
1991  break;
1992  }
1993  case CYAN:
1994  {
1995  lc.setRow(Device, TOP_RED, false);
1996  lc.setRow(Device,TOP_GREEN,Value);
1997  lc.setRow(Device,TOP_BLUE,Value);
1998  break;
1999  }
2000  case WHITE:
2001  {
2002  lc.setRow(Device,TOP_RED,Value);
2003  lc.setRow(Device,TOP_GREEN,Value);
2004  lc.setRow(Device,TOP_BLUE,Value);
2005  break;
2006  }
2007  }
2008 }
2009 
2010 //**************************************************************************************************************************************************************************
2011 //**************************************************************************************************************************************************************************
2012 //
2013 // BottomLEDFlash turns on the Red Block LEDs on the Bottom Front of the Periscope
2014 //
2015 // FlashPattern: The pattern of the Bottom LED array
2016 // OnTime: How long LEDs are ON
2017 // OffTime: How long LEDs are OFF
2018 // Random: 1 = Random Pattern Selection
2019 //
2020 
2021 void BottomLEDFlash (byte FlashPattern, int OnTime, int OffTime, byte Random)
2022 {
2024  {
2025  if (BottomLEDFlashTime++ > OnTime)
2026  {
2027  BottomLEDFlashTime = 0;
2028  if (OffTime) // do not turn off the LED's if OffTime = 0
2029  {
2030  lc.setRow(0, BOTTOM, OFF);
2031  }
2032  BottomLEDFlashState = 0;
2033  }
2034  }
2035  else
2036  {
2037  if (BottomLEDFlashTime++ > OffTime) // wait to turn On LED
2038  {
2039  BottomLEDFlashTime = 0;
2040  if (OnTime) // do not turn off the LED's if OffTime = 0
2041  {
2042  if (Random)
2043  {
2044  FlashPattern = random(1, time);
2045  }
2046  lc.setRow(0, BOTTOM, FlashPattern);
2047  }
2048  BottomLEDFlashState = 1;
2049  }
2050  }
2051 } // end of BottomLEDFlash()
2052 
2053 
2054 
2056 {
2057  first_time = 1; // used for 3-bit input reading - reset when 3-bit address value changes
2058 
2060 
2062 
2063  FlashTopLEDOnState = 0;
2064  RightSideLEDOnState = 0;
2065  LeftSideLEDOnState = 0;
2066  BottomLEDFlashState = 0;
2067  MainFlashState = 0;
2068 
2069  BigLEDOnState = 0;
2070 
2071  MainLEDCodeState = 0;
2072  BigLEDCodeState = 0;
2073 
2074  Top_Position = 6;
2075  Bottom_Position = 0;
2076  center_pos = 0;
2077 
2078  time = 0;
2079  last_time = 0;
2080  Main_Loop_Time = 0;
2081 
2082  MainTime = 0;
2083 
2084  TopTime = 0;
2085  BottomTime = 0;
2086  RightTime = 0;
2087  LeftTime = 0;
2088 
2089  MainSpinTime = 0;
2090  MainFlashTime = 0;
2091  BigLEDFlashTime = 0;
2092  TopFlashTime = 0;
2093  SplitTopTime = 0;
2094  RadiateTopTime = 0;
2095  RightSideLEDTime = 0;
2096  LeftSideLEDTime = 0;
2097 
2099  RearTopLEDFlashTime = 0;
2101  SequenceOneTime = 0;
2102  SequenceTwoTime = 0;
2103  SequenceThreeTime = 0;
2104  SequenceFourTime = 0;
2105  SequenceFiveTime = 0;
2106  SequenceSixTime = 0;
2107  SequenceSevenTime = 0;
2108  SequenceEightTime = 0;
2109  BottomLEDFlashTime = 0;
2110 
2111  Speed = 10;
2112  Brightness = 15;
2113 
2114  DigInState = 0;
2115  lastDigInState;// = 0;
2116 
2117  Pattern = 0;
2118  TopColor = 0;
2119  TopRate = 10;
2120  TopRateOFF = 10;
2121 
2122  FastTopColor = 0;
2123  FastTopRate = 10;
2124  FastTopRateOFF = 10;
2125 
2126  MainPattern = 0;
2128  MainLEDSpinNumber = 0;
2129  MainLEDFlashPattern = 0;
2130  MainLEDRate = 0;
2131  MainLEDOFF = 0;
2132 
2133  BigLEDCodeON = 0;
2134  BigLEDCodeOFF = 0;
2135 
2136  BigLEDCodeMode = 0;
2137 
2138  BigLEDCodeTime = 0;
2139  BigLEDPatternTime = 1000;
2140 
2141  TopLEDCodeTime = 0;
2142  PatternSelectTime = 1000;
2143 
2144  FastTopLEDCodeTime = 0;
2145  FastPatternSelectTime = 100;
2146  FastPattern = 0;
2147 
2148  MainLEDCodeTime = 0;
2149  MainLEDPatternTime = 0;
2150 
2151  lc.shutdown(0, false);
2152  lc.clearDisplay(0);
2153  lc.setIntensity(0,15); // 0 = dim, 15 = full brightness
2154  lc.setScanLimit(0, 7);
2155  pinMode(5, OUTPUT); // BIG CENTER LED - OUTPUT
2156  pinMode(17, INPUT); // set pin C3 to input - input A
2157  pinMode(18, INPUT); // set pin C4 to input - input B
2158  pinMode(19, INPUT); // set pin C5 to input - input C
2159  digitalWrite(17, HIGH); // turn on pullup resistors
2160  digitalWrite(18, HIGH); // turn on pullup resistors
2161  digitalWrite(19, HIGH); // turn on pullup resistors
2162 
2163 }
2164 //*************************************************************************************//*************************************************************************************//*************************************************************************************
2165 //*****************************************************************************************************************************************************************************************
2166 /*
2167 void BigLEDCode(int Rate)
2168 {
2169  switch (BigLEDCodeState)
2170  {
2171  case 0: // select random parameters
2172  {
2173 
2174  // randomly decide if the BIG led is going to ON (50/50 chance)
2175  // if it is going to turn on, then choose the pattern randomly, solid, quick flash, show flash
2176  BigLEDCodeMode = random(0, 8); // 0-6=off, 7-8=on, 9=SPARKLE
2177  // BigLEDCodeON = random(0, 100);
2178  // BigLEDCodeOFF = random(0, 100);
2179  BigLEDPatternTime = Rate*random(5, 100);
2180  BigLEDCodeState++;
2181  }
2182  case 1:
2183  {
2184  switch (BigLEDCodeMode)
2185  {
2186  case 0: // OFF
2187  { }
2188  case 1: // OFF
2189  { }
2190  case 2: // OFF
2191  { }
2192  case 3: // OFF
2193  {
2194  BigLED(0, 1);
2195  break;
2196  }
2197  case 4: // ON
2198  { }
2199  case 5: // ON
2200  {
2201  BigLED(1, 0);
2202  break;
2203  }
2204  case 6: // FLASH
2205  {
2206  Sparkle();
2207  break;
2208  }
2209  }
2210  if( BigLEDCodeTime++ > BigLEDPatternTime)
2211  {
2212  BigLEDCodeTime = 0;
2213  BigLEDCodeState = 0;
2214  }
2215  }
2216  }
2217 } */
2218 
2219 
2220 /*
2221 
2222  * Set the 8 Led's in a row to a new state
2223  * Params:
2224  * int addr The address of the display to control
2225  * int row The row on which the led's are to be set
2226  * Only values between 0 and 7 are valid.
2227  * byte value A bit set to 1 in this value will light up the
2228  * corresponding led.
2229  void setRow(int addr, int row, byte value);
2230 
2231 
2232  * Set the 8 Led's in a column to a new state
2233  * Params:
2234  * int addr The address of the display to control
2235  * int col The column on which the led's are to be set
2236  * Only values between 0 and 7 are valid.
2237  * byte value A bit set to 1 in this value will light up the
2238  * corresponding led.
2239  void setColumn(int addr, int col, byte value);
2240 
2241 
2242  * Set the status for a specific Led.
2243  * Params :
2244  * int addr the address of the display to control
2245  * int row the row in which the led is located
2246  * Only values between 0 and 7 are valid.
2247  * int col the column in which the led is located
2248  * Only values between 0 and 7 are valid.
2249  * boolean state If true the led is switched on, if false it is switched off
2250  void setLed(int addr, int row, int col, boolean state);
2251  */
MainRingSpin
void MainRingSpin(byte SpinNumber, int SpinRate, byte SpinDir)
Definition: PeriscopeLight.h:1696
BACK_MAGENTA
#define BACK_MAGENTA
Definition: PeriscopeLight.h:62
BigLEDCodeState
byte BigLEDCodeState
Definition: PeriscopeLight.h:105
MAGENTA
#define MAGENTA
Definition: PeriscopeLight.h:31
BLUE
#define BLUE
Definition: PeriscopeLight.h:30
FRONT_BLUE
#define FRONT_BLUE
Definition: PeriscopeLight.h:52
SequenceThreeState
byte SequenceThreeState
Definition: PeriscopeLight.h:89
SequenceFiveTime
int SequenceFiveTime
Definition: PeriscopeLight.h:138
SetTopRow
void SetTopRow(byte Device, byte Row, byte Value)
Definition: PeriscopeLight.h:1952
FastPatternSelectTime
unsigned int FastPatternSelectTime
Definition: PeriscopeLight.h:178
TopTime
int TopTime
Definition: PeriscopeLight.h:117
OFF
#define OFF
Definition: PeriscopeLight.h:15
MainLEDSpinNumber
byte MainLEDSpinNumber
Definition: PeriscopeLight.h:161
RightLEDstate
byte RightLEDstate
Definition: PeriscopeLight.h:79
BottomLEDFlashTime
int BottomLEDFlashTime
Definition: PeriscopeLight.h:142
MainLEDSpinDirection
byte MainLEDSpinDirection
Definition: PeriscopeLight.h:160
TopColor
byte TopColor
Definition: PeriscopeLight.h:151
FastTopLEDCode
void FastTopLEDCode()
Definition: PeriscopeLight.h:468
LEFT
#define LEFT
Definition: PeriscopeLight.h:21
Brightness
byte Brightness
Definition: PeriscopeLight.h:145
SequenceSixTime
int SequenceSixTime
Definition: PeriscopeLight.h:139
LeftLEDstate
byte LeftLEDstate
Definition: PeriscopeLight.h:80
RadiateTopLEDstate
byte RadiateTopLEDstate
Definition: PeriscopeLight.h:83
PatternSelectTime
unsigned int PatternSelectTime
Definition: PeriscopeLight.h:175
RightTime
int RightTime
Definition: PeriscopeLight.h:119
SplitBounceTopLEDstate
byte SplitBounceTopLEDstate
Definition: PeriscopeLight.h:82
RearSingleLEDFlashTime
int RearSingleLEDFlashTime
Definition: PeriscopeLight.h:131
TOP_BLUE
#define TOP_BLUE
Definition: PeriscopeLight.h:25
LeftSideLED
void LeftSideLED(byte Pattern, byte Pattern2, byte OnTime, byte OffTime)
Definition: PeriscopeLight.h:974
SearchLight
void SearchLight()
Definition: PeriscopeLight.h:871
BACK_YELLOW
#define BACK_YELLOW
Definition: PeriscopeLight.h:60
first_time
byte first_time
Definition: PeriscopeLight.h:75
last_time
unsigned long last_time
Definition: PeriscopeLight.h:112
RightSideLED
void RightSideLED(byte Pattern, byte Pattern2, byte OnTime, byte OffTime)
Definition: PeriscopeLight.h:932
DigInState
byte DigInState
Definition: PeriscopeLight.h:147
BOTTOM_WHITE
#define BOTTOM_WHITE
Definition: PeriscopeLight.h:72
MainFlashTime
int MainFlashTime
Definition: PeriscopeLight.h:123
FlashTopLED
void FlashTopLED(byte FlashPattern, byte Color, byte OnTime, byte OffTime, byte Random)
Definition: PeriscopeLight.h:1541
BigLEDCodeMode
byte BigLEDCodeMode
Definition: PeriscopeLight.h:169
BOTTOM
#define BOTTOM
Definition: PeriscopeLight.h:20
FlashTopLEDOnState
byte FlashTopLEDOnState
Definition: PeriscopeLight.h:96
center_pos
byte center_pos
Definition: PeriscopeLight.h:109
RightSideLEDOnState
byte RightSideLEDOnState
Definition: PeriscopeLight.h:97
RearTopLED
void RearTopLED(byte Pattern, byte OnTime, byte OffTime)
Definition: PeriscopeLight.h:1084
BounceTopLEDstate
byte BounceTopLEDstate
Definition: PeriscopeLight.h:81
BigLEDOnState
byte BigLEDOnState
Definition: PeriscopeLight.h:102
Sparkle
void Sparkle(byte mode)
Definition: PeriscopeLight.h:896
BigLEDPatternTime
unsigned int BigLEDPatternTime
Definition: PeriscopeLight.h:172
TopLEDCodeTime
unsigned int TopLEDCodeTime
Definition: PeriscopeLight.h:174
SequenceTwoTime
int SequenceTwoTime
Definition: PeriscopeLight.h:135
ObiWan
void ObiWan(int Rate)
Definition: PeriscopeLight.h:661
SequenceTwoState
byte SequenceTwoState
Definition: PeriscopeLight.h:88
TopLEDCode
void TopLEDCode()
Definition: PeriscopeLight.h:359
TOP_RED
#define TOP_RED
Definition: PeriscopeLight.h:18
RearTopLEDOnState
byte RearTopLEDOnState
Definition: PeriscopeLight.h:85
time
unsigned long time
Definition: PeriscopeLight.h:111
TOP_GREEN
#define TOP_GREEN
Definition: PeriscopeLight.h:24
Sith
void Sith(int Rate)
Definition: PeriscopeLight.h:616
BACK_GREEN
#define BACK_GREEN
Definition: PeriscopeLight.h:58
MainLEDPatternTime
unsigned int MainLEDPatternTime
Definition: PeriscopeLight.h:182
REAR_BI_LED_TOP_PIN
#define REAR_BI_LED_TOP_PIN
Definition: PeriscopeLight.h:37
FRONT_WHITE
#define FRONT_WHITE
Definition: PeriscopeLight.h:56
RadiateTopLED
byte RadiateTopLED(byte Color, byte Rate)
Definition: PeriscopeLight.h:1405
lastDigInState
byte lastDigInState
Definition: PeriscopeLight.h:148
RearSingleLEDOnState
byte RearSingleLEDOnState
Definition: PeriscopeLight.h:84
Bottom_Position
byte Bottom_Position
Definition: PeriscopeLight.h:108
MainLEDCode
void MainLEDCode()
Definition: PeriscopeLight.h:303
MainLEDCodeState
byte MainLEDCodeState
Definition: PeriscopeLight.h:104
BigLEDCodeOFF
byte BigLEDCodeOFF
Definition: PeriscopeLight.h:167
FastTopLEDCodeTime
unsigned int FastTopLEDCodeTime
Definition: PeriscopeLight.h:177
BigLEDCodeTime
unsigned int BigLEDCodeTime
Definition: PeriscopeLight.h:171
MainLEDCodeTime
unsigned int MainLEDCodeTime
Definition: PeriscopeLight.h:181
FRONT_GREEN
#define FRONT_GREEN
Definition: PeriscopeLight.h:51
BottomLEDChase
void BottomLEDChase(byte Time)
Definition: PeriscopeLight.h:1832
BottomLEDChaseState
byte BottomLEDChaseState
Definition: PeriscopeLight.h:78
RightSideLEDTime
int RightSideLEDTime
Definition: PeriscopeLight.h:128
TOP_WHITE
#define TOP_WHITE
Definition: PeriscopeLight.h:71
loop
void loop()
Definition: PeriscopeLight.h:205
Yoda
void Yoda(int Rate)
Definition: PeriscopeLight.h:789
WHITE
#define WHITE
Definition: PeriscopeLight.h:34
SequenceEightState
byte SequenceEightState
Definition: PeriscopeLight.h:94
SequenceFourTime
int SequenceFourTime
Definition: PeriscopeLight.h:137
MainLEDOFF
int MainLEDOFF
Definition: PeriscopeLight.h:164
HIGH
#define HIGH
Definition: ButtonController.h:26
TopRate
int TopRate
Definition: PeriscopeLight.h:152
BACK_BLUE
#define BACK_BLUE
Definition: PeriscopeLight.h:59
FRONT_RED
#define FRONT_RED
Definition: PeriscopeLight.h:50
LeftSideLEDOnState
byte LeftSideLEDOnState
Definition: PeriscopeLight.h:98
MainFlashState
byte MainFlashState
Definition: PeriscopeLight.h:100
lc
LedControl lc
Definition: PeriscopeLight.h:193
Top_Position
byte Top_Position
Definition: PeriscopeLight.h:107
FastPattern
byte FastPattern
Definition: PeriscopeLight.h:179
BACK_CYAN
#define BACK_CYAN
Definition: PeriscopeLight.h:61
YELLOW
#define YELLOW
Definition: PeriscopeLight.h:33
BACK_WHITE
#define BACK_WHITE
Definition: PeriscopeLight.h:63
MainLEDFlashPattern
byte MainLEDFlashPattern
Definition: PeriscopeLight.h:162
BigLEDFlashTime
int BigLEDFlashTime
Definition: PeriscopeLight.h:124
BounceTopLED
byte BounceTopLED(byte Color, byte Rate)
Definition: PeriscopeLight.h:1223
Speed
byte Speed
Definition: PeriscopeLight.h:144
RIGHT
#define RIGHT
Definition: PeriscopeLight.h:22
RearSingleLED
void RearSingleLED(byte Pattern, byte OnTime, byte OffTime)
Definition: PeriscopeLight.h:1017
RearBottomLED
void RearBottomLED(byte Pattern, byte OnTime, byte OffTime)
Definition: PeriscopeLight.h:1150
SetTopLed
void SetTopLed(byte Device, byte Row, byte Col, byte State)
Definition: PeriscopeLight.h:1883
Main_Loop_Time
unsigned long Main_Loop_Time
Definition: PeriscopeLight.h:113
SequenceFourState
byte SequenceFourState
Definition: PeriscopeLight.h:90
FastTopRateOFF
int FastTopRateOFF
Definition: PeriscopeLight.h:157
LeftTime
int LeftTime
Definition: PeriscopeLight.h:120
FRONT_CYAN
#define FRONT_CYAN
Definition: PeriscopeLight.h:54
TopRateOFF
int TopRateOFF
Definition: PeriscopeLight.h:153
RearBottomLEDFlashTime
int RearBottomLEDFlashTime
Definition: PeriscopeLight.h:133
REAR
#define REAR
Definition: PeriscopeLight.h:19
SequenceOneTime
int SequenceOneTime
Definition: PeriscopeLight.h:134
SequenceSevenTime
int SequenceSevenTime
Definition: PeriscopeLight.h:140
BottomTime
int BottomTime
Definition: PeriscopeLight.h:118
LeftSideLEDTime
int LeftSideLEDTime
Definition: PeriscopeLight.h:129
BottomLEDFlash
void BottomLEDFlash(byte FlashPattern, int OnTime, int OffTime, byte Random)
Definition: PeriscopeLight.h:2021
RED
#define RED
Definition: PeriscopeLight.h:28
ALL
#define ALL
Definition: PeriscopeLight.h:47
Dagobah
void Dagobah(int Rate)
Definition: PeriscopeLight.h:578
GREEN
#define GREEN
Definition: PeriscopeLight.h:29
Pattern
byte Pattern
Definition: PeriscopeLight.h:150
BottomLEDFlashState
byte BottomLEDFlashState
Definition: PeriscopeLight.h:99
MainSpinTime
int MainSpinTime
Definition: PeriscopeLight.h:122
SequenceOneState
byte SequenceOneState
Definition: PeriscopeLight.h:87
SplitTopTime
int SplitTopTime
Definition: PeriscopeLight.h:126
Initialize
void Initialize()
Definition: PeriscopeLight.h:2055
MainPattern
byte MainPattern
Definition: PeriscopeLight.h:159
MainTime
unsigned int MainTime
Definition: PeriscopeLight.h:115
FRONT_MAGENTA
#define FRONT_MAGENTA
Definition: PeriscopeLight.h:55
BigLED
void BigLED(int OnTime, int OffTime)
Definition: PeriscopeLight.h:1585
MainRingFlash
void MainRingFlash(byte FlashPattern, int OnTime, int OffTime, byte Random)
Definition: PeriscopeLight.h:1640
CYAN
#define CYAN
Definition: PeriscopeLight.h:32
RearTopLEDFlashTime
int RearTopLEDFlashTime
Definition: PeriscopeLight.h:132
SequenceThreeTime
int SequenceThreeTime
Definition: PeriscopeLight.h:136
BigLEDCodeON
byte BigLEDCodeON
Definition: PeriscopeLight.h:166
SequenceFiveState
byte SequenceFiveState
Definition: PeriscopeLight.h:91
MainLEDRate
int MainLEDRate
Definition: PeriscopeLight.h:163
LOW
#define LOW
Definition: ButtonController.h:27
CENTER
#define CENTER
Definition: PeriscopeLight.h:23
setup
void setup()
Definition: PeriscopeLight.h:195
TopFlashTime
int TopFlashTime
Definition: PeriscopeLight.h:125
SequenceSevenState
byte SequenceSevenState
Definition: PeriscopeLight.h:93
FRONT_YELLOW
#define FRONT_YELLOW
Definition: PeriscopeLight.h:53
FastTopRate
int FastTopRate
Definition: PeriscopeLight.h:156
SplitBounceTopLED
byte SplitBounceTopLED(byte Color, byte Rate)
Definition: PeriscopeLight.h:1296
FastTopColor
byte FastTopColor
Definition: PeriscopeLight.h:155
SequenceEightTime
int SequenceEightTime
Definition: PeriscopeLight.h:141
SequenceSixState
byte SequenceSixState
Definition: PeriscopeLight.h:92
RadiateTopTime
int RadiateTopTime
Definition: PeriscopeLight.h:127
RearBottomLEDOnState
byte RearBottomLEDOnState
Definition: PeriscopeLight.h:86
BACK_RED
#define BACK_RED
Definition: PeriscopeLight.h:57