Changeset - 6255b67a731b
[Not reviewed]
default
0 1 0
Dennis Fink - 7 years ago 2017-12-13 00:36:31
dennis.fink@c3l.lu
Add config options
1 file changed with 32 insertions and 8 deletions:
0 comments (0 inline, 0 general)
Neopixel_Goggles.ino
Show inline comments
 
@@ -3,8 +3,32 @@
 
#include <avr/power.h>
 
#endif
 

	
 
/* Begin config section
 
-----------------------*/
 

	
 
#define PIN 0
 

	
 
#define BRIGHTNESS 64
 

	
 
#define MODE_CHANGE_TIME 10000
 

	
 
#define SLOW_INTERVAL_MIN 25
 
#define SLOW_INTERVAL_MAX 55
 

	
 
#define COLOR_MIN 0
 
#define COLOR_MAX 255
 

	
 
#define STEPS_MIN 5
 
#define STEPS_MAX 10
 

	
 
#define RAINBOW_CYCLE_MIN_INTERVAL 1
 
#define RAINBOW_CYCLE_MAX_INTERVAL 10
 

	
 
#define BLINK_MIN_INTERVAL 250
 
#define BLINK_MAX_INTERVAL 500
 

	
 
/* End config section */
 

	
 
enum  pattern {
 
  RAINBOW_CYCLE,
 
  COLOR_WIPE,
 
@@ -268,15 +292,15 @@ void setup() {
 
  if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
 
#endif
 
  Rings.begin();
 
  Rings.setBrightness(64);
 
  Rings.RainbowCycle(random(1, 11));
 
  Rings.setBrightness(BRIGHTNESS);
 
  Rings.RainbowCycle(random(RAINBOW_CYCLE_MIN_INTERVAL, RAINBOW_CYCLE_MAX_INTERVAL + 1));
 
  prev_time = millis();
 
}
 

	
 
void loop() {
 
  Rings.Update();
 
  uint32_t t = millis();
 
  if ((t - prev_time) >= 10000) {
 
  if ((t - prev_time) >= MODE_CHANGE_TIME) {
 
    mode = random(0, 9);
 
    prev_time = t;
 
  }
 
@@ -284,13 +308,13 @@ void loop() {
 

	
 
void RingsComplete()
 
{
 
  uint16_t slow_interval = random(25, 56);
 
  uint16_t slow_interval = random(SLOW_INTERVAL_MIN, SLOW_INTERVAL_MAX + 1);
 
  //uint16_t fast_interval = random(1, 11);
 
  uint32_t color = Rings.Wheel(random(1, 256));
 
  uint16_t steps = random(5, 11);
 
  uint32_t color = Rings.Wheel(random(COLOR_MIN, COLOR_MAX + 1));
 
  uint16_t steps = random(STEPS_MIN, STEPS_MAX + 1);
 
  switch (mode) {
 
    case 0:
 
      Rings.RainbowCycle(random(1, 11));
 
      Rings.RainbowCycle(random(RAINBOW_CYCLE_MIN_INTERVAL, RAINBOW_CYCLE_MAX_INTERVAL + 1));
 
      break;
 
    case 1:
 
      Rings.ColorWipe(color, slow_interval);
 
@@ -311,7 +335,7 @@ void RingsComplete()
 
      Rings.DoubleRandom(color, steps, slow_interval);
 
      break;
 
    case 7:
 
      Rings.Blink(color, steps, random(250, 501));
 
      Rings.Blink(color, steps, random(BLINK_MIN_INTERVAL, BLINK_MAX_INTERVAL + 1));
 
      break;
 
    case 8:
 
      Rings.Dot(color, steps, slow_interval);
0 comments (0 inline, 0 general)