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.