Go Down

### Topic: Programming shiftbrites (Read 1 time)previous topic - next topic

#### Airness1

##### Oct 28, 2011, 06:49 pm
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

#1
##### Oct 28, 2011, 10:38 pm
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

#2
##### Oct 31, 2011, 03:08 pm
thanks that got me going.
are there any charts or anything that would give me what numbers equal what colors?

#### KirAsh4

#3
##### Oct 31, 2011, 09:13 pm
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

#4
##### Nov 01, 2011, 12:37 pm
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.

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

Please enter a valid email to subscribe