Difference between revisions of "WingScreen"

From Noisebridge
Jump to navigation Jump to search
(air app code)
(→‎StripSerial: code mangling at worx)
 
(5 intermediate revisions by 3 users not shown)
Line 31: Line 31:
 
</pre>
 
</pre>
  
== StripHSV ==
+
== StripSerial ==
 
Rainbeau test sketch for strip of addressable RGB LEDs.
 
Rainbeau test sketch for strip of addressable RGB LEDs.
  
 
Requires http://fastled.io/ library.
 
Requires http://fastled.io/ library.
 +
 +
Updated with optional remote serial control from PC. [[User:Six26|Six26]] ([[User talk:Six26|talk]]) 22:19, 12 September 2014 (UTC)
  
 
<pre>
 
<pre>
 +
/*
 +
*  Serial control interface for LED Strip
 +
*
 +
*    Updated: 20140923
 +
*
 +
*      H4X0r'd some shitz uppple
 +
*        -- insert LED of some sort in A0 & Ground (in right direction)
 +
*        -- pseudo lite senzor for mode switching
 +
*        -- pseudo lite mode 8 noise floor graph
 +
*
 +
*    Command Summary:
 +
*      MODE0 == Auto (Rainbeau)
 +
*      MODE1 == Off
 +
*      MODE2 == Remote (PC Control)
 +
*      HH..H == Sequence of Hue values to apply to LEDs
 +
*        Note: Set "MODE2" before sending hues
 +
*      S    == Set saturation
 +
*      MODE3 == Center Peak Rainbeau
 +
*      MODE4 == Center Peak Pastel
 +
*/
 +
 
#include "FastLED.h"
 
#include "FastLED.h"
  
 
// How many leds in your strip?
 
// How many leds in your strip?
#define NUM_LEDS 12
+
#define NUM_LEDS 72
  
 
// Spacing between pixel/color
 
// Spacing between pixel/color
#define HSV_PAD 22
+
#define HSV_PAD 4
  
 
// Delay between cycles
 
// Delay between cycles
#define LOOP_DELAY 20
+
#define LOOP_DELAY 50
  
// For led chips like Neopixels, which have a data line, ground, and power, you just
+
// Strip Data In (DI)
// need to define DATA_PIN.  For led chipsets that are SPI based (four wires - data, clock,
 
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
 
 
#define DATA_PIN 11
 
#define DATA_PIN 11
// #define CLOCK_PIN 13
 
  
 
// Define the array of leds
 
// Define the array of leds
 
CRGB leds[NUM_LEDS];
 
CRGB leds[NUM_LEDS];
  
 +
float counter = 0;
 
byte count = 0;
 
byte count = 0;
 +
 +
byte mode = 8;
 +
byte hues[NUM_LEDS];
 +
byte sat = 255;      // Saturation 0-255
 +
 +
boolean irEnable = true;
 +
float ir = 0.0;
 +
 +
const int morse[27] = {2,0,1,0,1,0,2,0,0,2,0,2,0,2,0,0,2,0,1,0,1,0,2,0,0,0,0};
 +
 +
String inputString = "";
  
 
void setup() {  
 
void setup() {  
      // Uncomment/edit one of the following lines for your leds arrangement.
+
  pinMode(13, OUTPUT);
      FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
+
 
 +
  for (int i = 0; i < NUM_LEDS; i++)
 +
  {
 +
    hues[i] = 0;
 +
  }
 +
 
 +
  /*
 +
  *  Confirm GRB color ordering for WS2812b
 +
  *       
 +
  *    \/ \/ \/ \/ BIG FAT NOTE \/ \/ \/ \/
 +
  *
 +
  */
 +
  FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
 +
 
 +
  // Max brightness 0-255 (64 ~< 100ma for 12 LEDs)
 +
  FastLED.setBrightness(64);
 +
 
 +
  Serial.begin(9600);
 +
  Serial.setTimeout(50);
 +
 
 +
  delay(200);
 +
}
 +
 
 +
void loop() {
 +
  int i;
 +
  int v;
 +
  float p;
 +
 
 +
  if (irEnable)
 +
  {
 +
    ir = max((analogRead(A0) / 1.0 - ir) * 0.5 - 10 + ir, ir);
 +
    if (ir > 60)
 +
    {
 +
      // Bump mode
 +
      ir = 0;
 +
      if (++mode > 8)
 +
        mode = 0;
 +
    }
 +
  }
 +
 
 +
 
 +
  if (mode == 0)
 +
  {
 +
    // Rainbeau
 +
    for (i = 0; i < NUM_LEDS; i++)
 +
    {
 +
      leds[i] = CHSV(count + (i * HSV_PAD), sat, 255);
 +
    }
 +
    FastLED.show();
 +
    count++;
 +
   
 +
    delay(LOOP_DELAY);
 +
  }
 +
  else if (mode == 1)
 +
  {
 +
    // Off
 +
    for (i = 0; i < NUM_LEDS; i++)
 +
    {
 +
      leds[i] = CRGB(0, 0, 0);
 +
    }
 +
    FastLED.show();
 +
   
 +
    delay(LOOP_DELAY);
 +
  }
 +
  else if (mode == 2)
 +
  {
 +
    // Remote
 +
  }
 +
  else if (mode == 3)
 +
  {
 +
    // Rainbeau
 +
    for (i = 0; i < NUM_LEDS; i++)
 +
    {
 +
      // variable position dimming
 +
      // Set 'p' to 0.0 - 1.0 so the ends are 0.0 and the center is 1.0
 +
      p = (((NUM_LEDS / 2) - abs(i - (NUM_LEDS / 2.0)))) / (NUM_LEDS / 2.0);
 +
      v = min(255, round(p * 255.0) + 64);
 +
 
 +
      // sin function added for oscillating color change
 +
      counter += 0.000001337;
 +
      count = sin(counter * 3.14 * 180) * 255 + (i * HSV_PAD);
 +
      leds[i] = CHSV(count, sat, v);
 +
    }
 +
    FastLED.show();
 +
    count++;
 +
   
 +
    delay(LOOP_DELAY);
 +
  }
 +
  else if (mode == 4)
 +
  {
 +
    // Rainbeau
 +
    for (i = 0; i < NUM_LEDS; i++)
 +
    {
 +
      // variable position dimming
 +
      // Set 'p' to 0.0 - 1.0 so the ends are 0.0 and the center is 1.0
 +
      p = (((NUM_LEDS / 2) - abs(i - (NUM_LEDS / 2.0)))) / (NUM_LEDS / 2.0);
 +
      v = min(255, round(p * 255.0) + 64);
 
        
 
        
       // FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
+
       // sin function added for oscillating color change
       // FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
+
      counter += 0.000001337;
      // FastLED.addLeds<NEOPIXEL, DATA_PIN, RGB>(leds, NUM_LEDS);
+
      count = sin(counter * 3.14 * 180) * 255 + (i * HSV_PAD);
 
+
       leds[i] = CHSV(count, sat - (v/1.5), v);
      // FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
+
    }
       // FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
+
    FastLED.show();
       // FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
+
    count++;
      // FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
+
   
      // FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
+
    delay(LOOP_DELAY);
      // FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS);
+
  }
      // FastLED.addLeds<LPD8806, RGB>(leds, NUM_LEDS);
+
  else if (mode == 5)
       // FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
+
  {
      // FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
+
    // Monochrome/Peak
       // FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
+
    for (i = 0; i < NUM_LEDS; i++)
 +
    {
 +
       p = (((NUM_LEDS / 2) - abs(i - (NUM_LEDS / 2.0)))) / (NUM_LEDS / 2.0);
 +
       v = min(255, round(p * 255.0) + 16);
 +
      leds[i] = CRGB(v, 0, 0); // CHSV(100, sat, v);
 +
    }
 +
   
 +
    // leds[int(random(0, NUM_LEDS))] = CRGB(96,0,0);
 +
   
 +
    FastLED.show();
 +
    count++;
 +
   
 +
    delay(LOOP_DELAY);
 +
  }
 +
  else if (mode == 6)
 +
  {
 +
    // count = 0;
 +
   
 +
    for (i = 0; i < NUM_LEDS; i++)
 +
    {
 +
       leds[i] = CHSV(morse[(i + count) % 27] == 1 ? 120 : 0, sat, morse[(i + count) % 27] == 0 ? 0 : 255);
 +
    }
 +
    FastLED.show();
 +
   
 +
    count++;
 +
   
 +
    delay(LOOP_DELAY);
 +
  }
 +
  else if (mode == 7)
 +
  {
 +
    byte r;
 +
   
 +
    for (i = 0; i < NUM_LEDS; i++)
 +
    {
 +
       // counter = sin(count * 3.14 * 180) * 255 + i;
 
        
 
        
       FastLED.setBrightness(64);
+
       r = random(127, 255);     
 +
      leds[i] = CRGB(r, random(0, 100) < 20 ? r : 0, 0);
 +
    }
 +
    // count++;
 +
   
 +
    FastLED.show();
 +
   
 +
    delay(LOOP_DELAY / 5);
 +
  }
 +
  else if (mode == 8)
 +
  {
 +
    // ir = max((analogRead(A0) / 1.0 - ir) * 0.5 - 10 + ir, ir);
 +
   
 +
    for (i = 0; i < NUM_LEDS; i++)
 +
    {
 +
      if (i < ir)
 +
      {
 +
        leds[i] = CHSV(0, 255, 255); // ir > 30 ? 127 : 32);
 +
      }
 +
      else
 +
      {
 +
        leds[i] = CHSV(66, 255, 32);
 +
      }
 +
    }
 +
   
 +
    // ir = min(0, ir - 1.337);
 +
   
 +
    FastLED.show();
 +
   
 +
    delay(LOOP_DELAY);
 +
  }
 +
 
 +
  if (irEnable)
 +
    ir = min(0, ir - 1.337);
 
}
 
}
  
void loop() {  
+
void updateHues() {
  // Rainbeau
 
 
   for (int i = 0; i < NUM_LEDS; i++)
 
   for (int i = 0; i < NUM_LEDS; i++)
 
   {
 
   {
     leds[i] = CHSV(count + (i * HSV_PAD), 255, 255);
+
     leds[i] = CHSV(hues[i], 255, 255);
 
   }
 
   }
 
   FastLED.show();
 
   FastLED.show();
 
    
 
    
   count++;
+
   // Toggle onboard LED
 +
  digitalWrite(13, !digitalRead(13));
 +
}
 +
 
 +
void serialEvent() {
 +
  byte byteCount = 0;
 +
  byte data;
 +
 
 +
  inputString = "";
 +
 
 +
  while(Serial.available())
 +
  {
 +
    data = Serial.read();
 +
    inputString += (char)data;
 +
    if (byteCount < NUM_LEDS)
 +
    {
 +
      hues[byteCount++] = data;
 +
    }
 +
   
 +
    // Catch pending bits
 +
    if (!Serial.available())
 +
      delay(20);
 +
  }
 
    
 
    
   delay(LOOP_DELAY);
+
   if (inputString == "MODE0")
 +
  {
 +
    mode = 0;
 +
  }
 +
  else if (inputString == "MODE1")
 +
  {
 +
    mode = 1;
 +
  }
 +
  else if (inputString == "MODE2")
 +
  {
 +
    mode = 2;
 +
  }
 +
  else if (inputString == "MODE3")
 +
  {
 +
    mode = 3;
 +
  }
 +
  else if (inputString == "MODE4")
 +
  {
 +
    mode = 4;
 +
  }
 +
  else if (inputString == "NINJA")
 +
  {
 +
    mode = 5;
 +
  }
 +
  else if (inputString == "MORSE")
 +
  {
 +
    mode = 6;
 +
  }
 +
  else if (inputString.length() == NUM_LEDS)
 +
  {
 +
    updateHues();
 +
  }
 +
  else if (inputString.length() == 1)
 +
  {
 +
    sat = data;
 +
  }
 
}
 
}
 
</pre>
 
</pre>
  
 
== Desktop Emulator ==
 
== Desktop Emulator ==
 +
[[File:HSV.jpg|960px]]
 +
 +
See also: [[FlashDevelop]]
 +
  
 
=== Main ===
 
=== Main ===

Latest revision as of 08:46, 23 September 2014

A side wing for teh screen

                                               /---------\
                                               |         |
                                  RGB LEDs --  *         |
                                           \   |         |
            .__                             -  *         |
    __  _  _|__| ____    ____                  |         |
    \ \/ \/ /  |/    \  / ___\                 *         |
     \     /|  |   |  \/ /_/  >                |         |
      \/\_/ |__|___|  /\___  /                 *         |
                    \//_____/                  |         |
   ('''' .|'', '||''| .|''|, .|''|, `||''|,    *         |
    `'') ||     ||    ||..|| ||..||  ||  ||    |         |
   `...' `|..' .||.   `|...  `|...  .||  ||.   *         |
                                               |         |
                                               *         |
                                               |         |
                                               *         |
                                               |         |
                                               *         |
                                               |         |
                      /---------\              *         |
                      |  micro  |              |         |
   USB-----|~|--------|  puter  |              *         |
                      \---------/              |         |
                             \                 *         |
                              \----------------|         |
                                               \---------/

StripSerial[edit]

Rainbeau test sketch for strip of addressable RGB LEDs.

Requires http://fastled.io/ library.

Updated with optional remote serial control from PC. Six26 (talk) 22:19, 12 September 2014 (UTC)

/*
*  Serial control interface for LED Strip
*
*    Updated: 20140923
*
*      H4X0r'd some shitz uppple
*        -- insert LED of some sort in A0 & Ground (in right direction)
*        -- pseudo lite senzor for mode switching
*        -- pseudo lite mode 8 noise floor graph
*
*    Command Summary:
*      MODE0 == Auto (Rainbeau)
*      MODE1 == Off
*      MODE2 == Remote (PC Control)
*      HH..H == Sequence of Hue values to apply to LEDs
*        Note: Set "MODE2" before sending hues
*      S     == Set saturation
*      MODE3 == Center Peak Rainbeau
*      MODE4 == Center Peak Pastel
*/

#include "FastLED.h"

// How many leds in your strip?
#define NUM_LEDS 72

// Spacing between pixel/color
#define HSV_PAD 4

// Delay between cycles
#define LOOP_DELAY 50

// Strip Data In (DI)
#define DATA_PIN 11

// Define the array of leds
CRGB leds[NUM_LEDS];

float counter = 0;
byte count = 0;

byte mode = 8;
byte hues[NUM_LEDS];
byte sat = 255;      // Saturation 0-255

boolean irEnable = true;
float ir = 0.0;

const int morse[27] = {2,0,1,0,1,0,2,0,0,2,0,2,0,2,0,0,2,0,1,0,1,0,2,0,0,0,0};

String inputString = "";

void setup() { 
  pinMode(13, OUTPUT);
  
  for (int i = 0; i < NUM_LEDS; i++)
  {
    hues[i] = 0;
  }
  
  /*
  *   Confirm GRB color ordering for WS2812b
  *        
  *    \/ \/ \/ \/ BIG FAT NOTE \/ \/ \/ \/
  *
  */
  FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
  
  // Max brightness 0-255 (64 ~< 100ma for 12 LEDs)
  FastLED.setBrightness(64);
  
  Serial.begin(9600);
  Serial.setTimeout(50);
  
  delay(200);
}

void loop() {
  int i;
  int v;
  float p;

  if (irEnable)
  {
    ir = max((analogRead(A0) / 1.0 - ir) * 0.5 - 10 + ir, ir);
    if (ir > 60)
    {
       // Bump mode
       ir = 0;
       if (++mode > 8)
         mode = 0;
    }
  }

  
  if (mode == 0)
  {
    // Rainbeau
    for (i = 0; i < NUM_LEDS; i++)
    {
      leds[i] = CHSV(count + (i * HSV_PAD), sat, 255);
    }
    FastLED.show();
    count++;
    
    delay(LOOP_DELAY);
  }
  else if (mode == 1)
  {
    // Off
    for (i = 0; i < NUM_LEDS; i++)
    {
      leds[i] = CRGB(0, 0, 0);
    }
    FastLED.show();
    
    delay(LOOP_DELAY);
  }
  else if (mode == 2)
  {
    // Remote
  }
  else if (mode == 3)
  {
    // Rainbeau
    for (i = 0; i < NUM_LEDS; i++)
    {
      // variable position dimming
      // Set 'p' to 0.0 - 1.0 so the ends are 0.0 and the center is 1.0
      p = (((NUM_LEDS / 2) - abs(i - (NUM_LEDS / 2.0)))) / (NUM_LEDS / 2.0);
      v = min(255, round(p * 255.0) + 64);

      // sin function added for oscillating color change
      counter += 0.000001337;
      count = sin(counter * 3.14 * 180) * 255 + (i * HSV_PAD);
      leds[i] = CHSV(count, sat, v);
    }
    FastLED.show();
    count++;
    
    delay(LOOP_DELAY);
  }
  else if (mode == 4)
  {
    // Rainbeau
    for (i = 0; i < NUM_LEDS; i++)
    {
      // variable position dimming
      // Set 'p' to 0.0 - 1.0 so the ends are 0.0 and the center is 1.0
      p = (((NUM_LEDS / 2) - abs(i - (NUM_LEDS / 2.0)))) / (NUM_LEDS / 2.0);
      v = min(255, round(p * 255.0) + 64);
      
      // sin function added for oscillating color change
      counter += 0.000001337;
      count = sin(counter * 3.14 * 180) * 255 + (i * HSV_PAD);
      leds[i] = CHSV(count, sat - (v/1.5), v);
    }
    FastLED.show();
    count++;
    
    delay(LOOP_DELAY);
  }
  else if (mode == 5)
  {
    // Monochrome/Peak
    for (i = 0; i < NUM_LEDS; i++)
    {
      p = (((NUM_LEDS / 2) - abs(i - (NUM_LEDS / 2.0)))) / (NUM_LEDS / 2.0);
      v = min(255, round(p * 255.0) + 16);
      leds[i] = CRGB(v, 0, 0); // CHSV(100, sat, v);
    }
    
    // leds[int(random(0, NUM_LEDS))] = CRGB(96,0,0);
    
    FastLED.show();
    count++;
    
    delay(LOOP_DELAY);
  }
  else if (mode == 6)
  {
    // count = 0;
    
    for (i = 0; i < NUM_LEDS; i++)
    {
      leds[i] = CHSV(morse[(i + count) % 27] == 1 ? 120 : 0, sat, morse[(i + count) % 27] == 0 ? 0 : 255);
    }
    FastLED.show();
    
    count++;
    
    delay(LOOP_DELAY);
  }
  else if (mode == 7)
  {
    byte r;
    
    for (i = 0; i < NUM_LEDS; i++)
    {
      // counter = sin(count * 3.14 * 180) * 255 + i;
      
      r = random(127, 255);      
      leds[i] = CRGB(r, random(0, 100) < 20 ? r : 0, 0);
    }
    // count++;
    
    FastLED.show();
    
    delay(LOOP_DELAY / 5);
  }
  else if (mode == 8)
  {
    // ir = max((analogRead(A0) / 1.0 - ir) * 0.5 - 10 + ir, ir);
    
    for (i = 0; i < NUM_LEDS; i++)
    {
      if (i < ir)
      {
        leds[i] = CHSV(0, 255, 255); // ir > 30 ? 127 : 32);
      }
      else
      {
        leds[i] = CHSV(66, 255, 32);
      }
    }
    
    // ir = min(0, ir - 1.337);
    
    FastLED.show();
    
    delay(LOOP_DELAY);
  }
  
  if (irEnable)
    ir = min(0, ir - 1.337);
}

void updateHues() {
  for (int i = 0; i < NUM_LEDS; i++)
  {
    leds[i] = CHSV(hues[i], 255, 255);
  }
  FastLED.show();
  
  // Toggle onboard LED
  digitalWrite(13, !digitalRead(13));
}

void serialEvent() {
  byte byteCount = 0;
  byte data;
  
  inputString = "";
  
  while(Serial.available())
  {
    data = Serial.read();
    inputString += (char)data;
    if (byteCount < NUM_LEDS)
    {
      hues[byteCount++] = data;
    }
    
    // Catch pending bits
    if (!Serial.available())
      delay(20);
  }
  
  if (inputString == "MODE0")
  {
    mode = 0;
  }
  else if (inputString == "MODE1")
  {
    mode = 1;
  }
  else if (inputString == "MODE2")
  {
    mode = 2;
  }
  else if (inputString == "MODE3")
  {
    mode = 3;
  }
  else if (inputString == "MODE4")
  {
    mode = 4;
  }
  else if (inputString == "NINJA")
  {
    mode = 5;
  }
  else if (inputString == "MORSE")
  {
    mode = 6;
  }
  else if (inputString.length() == NUM_LEDS)
  {
    updateHues();
  }
  else if (inputString.length() == 1)
  {
    sat = data;
  }
}

Desktop Emulator[edit]

HSV.jpg

See also: FlashDevelop


Main[edit]

package 
{
	import flash.display.Screen;
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.geom.Rectangle;
	
	/**
	 * ...
	 * @author thex
	 */
	public class Main extends Sprite 
	{
		private var wing:Wing;
		
		public function Main():void 
		{
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			
			initUI();
		}
		
		private function initUI():void
		{			
			var appBounds:Rectangle = stage.nativeWindow.bounds;
			var screen:Screen = Screen.getScreensForRectangle(appBounds)[0];
			var screenSize:Rectangle = screen.bounds;
			
			/* Set in compile config
			  stage.nativeWindow.x = 0;
			  stage.nativeWindow.y = 0;
			*/
			  
			stage.nativeWindow.width = screenSize.width;
			
			wing = new Wing(12, screenSize.width, stage.stageHeight);
			addChild(wing);
		}
		
	}
	
}

Wing[edit]

package  
{
	import flash.display.GradientType;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.geom.Matrix;
	import flash.utils.getTimer;
	
	/**
	 * ...
	 * @author thex
	 */
	public class Wing extends Sprite 
	{
		private var count:int = 0;
		private var dots:Array = new Array();
		
		public function Wing(dotCount:int, wingWidth:int, wingHeight:int ) 
		{
			trace("Wing: " + wingWidth.toString() + ", " + wingHeight.toString());
			
			var matrix:Matrix = new Matrix();
			matrix.createGradientBox(wingWidth, wingHeight, 1.571, 0, 0);			
			
			this.graphics.beginGradientFill(GradientType.LINEAR, [0x3f3f3f, 0x000000], [1, 1], [0, 220], matrix);
			this.graphics.drawRect(0, 0, wingWidth, wingHeight);
			
			count = dotCount;
			
			initDots();
			
			this.addEventListener(Event.ENTER_FRAME, frameHandler);
		}
		
		private function initDots():void
		{
			var dot:Dot;
			var xOff:Number = (width - (count * Dot.WIDTH)) / count;
			
			for (var i:int = 0; i < count; i++)
			{
				dot = new Dot();
				dot.x = i * (xOff + Dot.WIDTH) + (xOff/2);
				dot.y = height - Dot.HEIGHT;
				
				dot.draw(HSVColor.HSV2RGB(i * 30));
				
				addChild(dot);
				
				dots.push(dot);
			}
		}
		
		private function update():void
		{
			var dot:Dot;
			var hue:Number;
			
			var phase:Number = (getTimer() / 20);
			
			for (var i:int = 0; i < count; i++)
			{
				dot = dots[i];
				
				// Magiq time Rainbeau
				hue = i * 30 + phase;
				hue %= 360;
				
				dot.draw(HSVColor.HSV2RGB(hue));
			}
		}
		
		private function frameHandler(e:Event):void
		{
			update();
		}
		
	}

}

Dot[edit]

package  
{
	import flash.display.Sprite;
	import flash.filters.GlowFilter;
	
	/**
	 * ...
	 * @author thex
	 */
	public class Dot extends Sprite 
	{
		public static var WIDTH:int = 64;
		public static var HEIGHT:int = 16;
		
		private static var OFF_COLOR:int = 0xcfcfcf;
		
		private var glowFilter:GlowFilter;
		
		public function Dot() 
		{			
			draw(OFF_COLOR);
		}
		
		public function draw(color:int):void
		{
			this.graphics.beginFill(color);
			this.graphics.drawRect(0, 0, WIDTH, HEIGHT);
			
			glowFilter = new GlowFilter(color, 1, 96, 256, 24, 1);
			filters = [glowFilter];
		}
		
	}

}

HSVColor[edit]

package  
{
	/**
	 * ...
	 * @author thex
	 */
	public class HSVColor 
	{
		
		public function HSVColor() 
		{
			
		}
		
		public static function HSV2RGB(h:Number, s:Number = 1.0, v:Number = 1.0):int
		{
			/*
			 * 
			 *  Ported from:
			 *   http://www.cs.rit.edu/~ncs/color/t_convert.html
			 * 
			 *  h = 0-360
			 *  s = 0-1, v = 0-1
			 */
			
			var r:Number;
			var g:Number;
			var b:Number;
			
			var i:int;
			
			var f:Number;
			var p:Number;
			var q:Number;
			var t:Number;

			if( s == 0 ) {
				// achromatic (grey)
				r = g = b = v;
				return 256 * 256 * r + 256 * g + b;
			}

			h /= 60.0;			// sector 0 to 5
			i = Math.floor( h );
			f = h - i;			// factorial part of h
			p = v * ( 1 - s );
			q = v * ( 1 - s * f );
			t = v * ( 1 - s * ( 1 - f ) );

			switch( i ) {
				case 0:
					r = v;
					g = t;
					b = p;
					break;
				case 1:
					r = q;
					g = v;
					b = p;
					break;
				case 2:
					r = p;
					g = v;
					b = t;
					break;
				case 3:
					r = p;
					g = q;
					b = v;
					break;
				case 4:
					r = t;
					g = p;
					b = v;
					break;
				default:		// case 5:
					r = v;
					g = p;
					b = q;
					break;
			}
			
			r = Math.round(r * 255);
			g = Math.round(g * 255);
			b = Math.round(b * 255);
			
			return 256 * 256 * r + 256 * g + b;
		}
		
	}

}