Go Down

Topic: Programming shiftbrites (Read 828 times) previous topic - next topic

Airness1

was looking for sample code for 65 shiftbrites chained together. This is my first crack at programming and it is quite foreign to me.
I have roughly half of them on and I have power to the last light. If someone would be so kind to post code for 65 shiftbrites so i can look at and build from here that would be great.
Just looking for something that will light them all up so i can determine if it is a hardware problem or a programming problem.
I will thank you in advance for any help.

macegr

You could just use one of the other examples on the documentation site. For example: http://docs.macetech.com/doku.php/hardware_spi_example

There is a line "#define NumLEDs 2" which you could change to "#define NumLEDs 65" or any other number (within reason).
Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

Airness1

thanks that got me going.
I had a couple of bad lights
are there any charts or anything that would give me what numbers equal what colors?

KirAsh4

That's fairly easy to figure out actually.  Take a regular RGB LED ...Red, Green, Blue.  Each channel can go from 0 to 255 (full brightness), or in HEX that would be 0x00 to 0xFF.

For the basic colors at 100% that's:
Red = 255 = 0xFF
Green = 255 = 0xFF
Blue = 255 = 0xFF
Yellow = Red + Green @ 0xFF
Cyan = Green + Blue @ 0xFF
Magenta = Red + Blue @ 0xFF
White = Red + Green + Blue @ 0xFF

Once you start mixing colors though, it gets harder to put an actual number to them because it's a combination of 2 or more channels.  Programmatically you can extract the color value, but just looking at, say the color orange, it's not easy to tell what channel is at what intensity.  It'll always be somewhere between 0 and 255 for each.

marklar

Color can be broken down into Hue Saturation and Value/Brightness to make the color scheme more logical.

Think of Hue is a wheel is broken into 360 colors - one for each degree of the circular wheel. 

The hue color wheel goes from red through yellow to green through cyan to blue and through majenta back to red as shown below.
http://upload.wikimedia.org/wikipedia/commons/f/f4/Color_circle_(hue-sat)_trans.png

At 100% saturation and 100% value/brightness the color is what you may call "full color", like the outside of that circle.  If you want to make it darker, change the value/brightness to a lower value.  To make it washed out then change the saturation to a lower value.  Zero value/brt is black.  Zero saturation is white or gray depending on value/brt.

You can use the following calculator to get the degree from the color wheel and plug it in.  Use 100 for saturation and 100 for value/brightness and enter a color value from 1 to 360 and you will get the RGB value for any color.
http://www.csgnetwork.com/csgcolorsel4.html

Hope that helps.


Go Up