Offline
Full Member
Karma: 1
Posts: 175
|
 |
« on: January 16, 2013, 07:48:19 pm » |
Hi All, I piceked up a Mega Brite RGB (Tiro) From Sparkfun.com https://www.sparkfun.com/products/10236. The thing is am very new to all this. (about a month) and I am not sure how to use it. I looked at the example sketch and was able to figure out the PIN's some what. But when I Run it only the Blue and red come on. Thanks of any help given . #define clockpin 13 // CI #define enablepin 10 // EI #define latchpin 9 // LI #define datapin 11 // DI #define NumLEDs 2 int LEDChannels[NumLEDs][3] = {0}; int SB_CommandMode; int SB_RedCommand; int SB_GreenCommand; int SB_BlueCommand; void setup() { pinMode(datapin, OUTPUT); pinMode(latchpin, OUTPUT); pinMode(enablepin, OUTPUT); pinMode(clockpin, OUTPUT); SPCR = (1<<SPE)|(1<<MSTR)|(0<<SPR1)|(0<<SPR0); digitalWrite(latchpin, LOW); digitalWrite(enablepin, LOW); } void SB_SendPacket() { if (SB_CommandMode == B01) { SB_RedCommand = 120; SB_GreenCommand = 100; SB_BlueCommand = 100; } SPDR = SB_CommandMode << 6 | SB_BlueCommand>>4; while(!(SPSR & (1<<SPIF))); SPDR = SB_BlueCommand<<4 | SB_RedCommand>>6; while(!(SPSR & (1<<SPIF))); SPDR = SB_RedCommand << 2 | SB_GreenCommand>>8; while(!(SPSR & (1<<SPIF))); SPDR = SB_GreenCommand; while(!(SPSR & (1<<SPIF))); } void WriteLEDArray() { SB_CommandMode = B00; // Write to PWM control registers for (int h = 0;h<NumLEDs;h++) { SB_RedCommand = LEDChannels[h][0]; SB_GreenCommand = LEDChannels[h][1]; SB_BlueCommand = LEDChannels[h][2]; SB_SendPacket(); } delayMicroseconds(15); digitalWrite(latchpin,HIGH); // latch data into registers delayMicroseconds(15); digitalWrite(latchpin,LOW); SB_CommandMode = B01; // Write to current control registers for (int z = 0; z < NumLEDs; z++) SB_SendPacket(); delayMicroseconds(15); digitalWrite(latchpin,HIGH); // latch data into registers delayMicroseconds(15); digitalWrite(latchpin,LOW); } void loop() { LEDChannels[0][0] = 1023; LEDChannels[0][1] = 0; LEDChannels[0][2] = 0; LEDChannels[1][0] = 0; LEDChannels[1][1] = 0; LEDChannels[1][2] = 1023; WriteLEDArray(); delay(200); LEDChannels[0][0] = 0; LEDChannels[0][1] = 0; LEDChannels[0][2] = 1023; LEDChannels[1][0] = 1023; LEDChannels[1][1] = 0; LEDChannels[1][2] = 0; WriteLEDArray(); delay(200); }
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 1
Posts: 175
|
 |
« Reply #1 on: January 16, 2013, 08:00:51 pm » |
My Bad,
After reading more about the sketch in the supplied Doc. All it is supposed to do is blink Red and Blue.
That being said, Now I really need help.
Thanks once more.
|
|
|
|
|
Logged
|
|
|
|
|
Samplefinger
Offline
God Member
Karma: 8
Posts: 819
ALWAYS ASK FOR THREE. One to use. One to lose. One to abuse.
|
 |
« Reply #2 on: January 16, 2013, 11:58:27 pm » |
What idiot designed the header angles on that board?
|
|
|
|
|
Logged
|
Latest Sampling Scores: ATXMEGA64A3U-MH x3, ATXMEGA256A3U-MH x3, SST38VF6404-90-5C-EKE x3, SST38VF6402-90-5C-EKE x3, PGA870 x3, THS770006 x3
|
|
|
|
SF Bay Area
Offline
Edison Member
Karma: 6
Posts: 1215
Arduino Ninja
|
 |
« Reply #3 on: January 17, 2013, 02:43:52 am » |
Me. They're...fun!
|
|
|
|
|
Logged
|
|
|
|
|
Samplefinger
Offline
God Member
Karma: 8
Posts: 819
ALWAYS ASK FOR THREE. One to use. One to lose. One to abuse.
|
 |
« Reply #4 on: January 17, 2013, 08:41:09 am » |
Me. They're...fun!
Then I take back the idiot part. And they are fun and interesting. But how doesn't that kill you for using it on a breadboard? It has to make it harder to interface it even on a custom made PCB because it's harder to verify its right before sending it off to be manufactured too. What is the point?
|
|
|
|
|
Logged
|
Latest Sampling Scores: ATXMEGA64A3U-MH x3, ATXMEGA256A3U-MH x3, SST38VF6404-90-5C-EKE x3, SST38VF6402-90-5C-EKE x3, PGA870 x3, THS770006 x3
|
|
|
|
Valencia, Spain
Offline
Edison Member
Karma: 65
Posts: 2262
|
 |
« Reply #5 on: January 17, 2013, 10:13:35 am » |
What is the point?
You can easily put six of them together in a circle to make a GigaBrite..?
|
|
|
|
|
Logged
|
|
|
|
|
Eugene, Oregon
Offline
Sr. Member
Karma: 8
Posts: 387
|
 |
« Reply #6 on: January 17, 2013, 12:02:26 pm » |
I really like the hexagonal shape, it tessellates quite nicely, you can make a honeycomb pattern. There are some interesting 3D polygons that you could make with a hexagon. Pentagonal would be real nice for 3D geometric shapes also.
|
|
|
|
|
Logged
|
|
|
|
|
Valencia, Spain
Offline
Edison Member
Karma: 65
Posts: 2262
|
 |
« Reply #7 on: January 17, 2013, 12:07:40 pm » |
I don't think you'd want to put both sets of pins in a breadboard anyway. One set of pins is just for daisychaining.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 1
Posts: 175
|
 |
« Reply #8 on: January 17, 2013, 12:37:59 pm » |
Me. They're...fun!
I have a Favor, because I am new to all this and I got a lot to learn. Any way you could post or PM me some more Example code. Or explain in a dumbed down version on the code that is in the Doc. I got some of it figured out. I can make all three LED's blink on and off and dim. But thats all. Thanks
|
|
|
|
« Last Edit: January 17, 2013, 01:02:27 pm by kculm »
|
Logged
|
|
|
|
|
Samplefinger
Offline
God Member
Karma: 8
Posts: 819
ALWAYS ASK FOR THREE. One to use. One to lose. One to abuse.
|
 |
« Reply #9 on: January 17, 2013, 01:09:56 pm » |
What is the point?
You can easily put six of them together in a circle to make a GigaBrite..? Buying enough for a gigabrite would get pricy... 
|
|
|
|
|
Logged
|
Latest Sampling Scores: ATXMEGA64A3U-MH x3, ATXMEGA256A3U-MH x3, SST38VF6404-90-5C-EKE x3, SST38VF6402-90-5C-EKE x3, PGA870 x3, THS770006 x3
|
|
|
|
Eugene, Oregon
Offline
Sr. Member
Karma: 8
Posts: 387
|
 |
« Reply #10 on: January 17, 2013, 01:22:34 pm » |
It takes 10 kilobucks to make one gigabright.
edit: Actually, i guess thats 9.95 Kbucks.
Doh, looks more like 7.96 Kbucks if you get 100 pricing...
4th edit: 2^10, seems appropriate...
|
|
|
|
« Last Edit: January 17, 2013, 01:28:11 pm by Hippynerd »
|
Logged
|
|
|
|
|
Samplefinger
Offline
God Member
Karma: 8
Posts: 819
ALWAYS ASK FOR THREE. One to use. One to lose. One to abuse.
|
 |
« Reply #11 on: January 17, 2013, 01:24:45 pm » |
It takes 10 kilobucks to make one gigabright.
edit: Actually, i guess thats 9.95 Kbucks.
It sounds like you are using 10^3 as your definition of kilo. It may be 2^10 in this case, but I am not sure. 
|
|
|
|
|
Logged
|
Latest Sampling Scores: ATXMEGA64A3U-MH x3, ATXMEGA256A3U-MH x3, SST38VF6404-90-5C-EKE x3, SST38VF6402-90-5C-EKE x3, PGA870 x3, THS770006 x3
|
|
|
|
Valencia, Spain
Offline
Edison Member
Karma: 65
Posts: 2262
|
 |
« Reply #12 on: January 17, 2013, 01:48:24 pm » |
I can imagine a big LED snowflake made with those. You couldn't do that with square ones. 
|
|
|
|
|
Logged
|
|
|
|
|
Eugene, Oregon
Offline
Sr. Member
Karma: 8
Posts: 387
|
 |
« Reply #13 on: January 17, 2013, 02:08:32 pm » |
Snowflakes make matrices look like squares.
|
|
|
|
|
Logged
|
|
|
|
|
SF Bay Area
Offline
Edison Member
Karma: 6
Posts: 1215
Arduino Ninja
|
 |
« Reply #14 on: January 17, 2013, 06:09:38 pm » |
The plan was to use them with cables and mount them on objects, rather than plug them into a breadboard or solder them into a PCB. Therefore the angled headers seemed less of a problem. We never did a redesign, but making the headers parallel was definitely on the to-do list.
|
|
|
|
|
Logged
|
|
|
|
|
|