12V LED strip drives by Rainbowduino
Rainbowduino isn’t only used to drive the LED matrix but also can be used to drive other things like: LED strip or motor.
Now here’s a demo using Rainbowduino to drive LED light strip for showing the numbers.
We used 7 strips to make up a number character. And connect the LED strip to Rainbowduino pins .Hook up the RGB pins of light strip to RGB pins of Rainbowduino respectively and the anode of light strip to the VCC of Rainbowduino.
Program the code bellows into Rainbowduino and you can see the number display form 0 to 9 .
#include "Rainbow.h"
unsigned char NumTab[10]=
{
0x77,0x06,0x5b,0x1f,0x2e,0x3d,0x7d,0x17,0x7f,0x3f
};
void setup()
{
_init();
close_all_line
open_all_line
}
void loop()
{
int i;
for(i=0;i<10;i++)
{
shift_24_bit(NumTab[i],0,0);
delay(500);
}
}
void _init(void) // define the pin mode
{
DDRD=0xff;
DDRC=0xff;
DDRB=0xff;
PORTD=0;
PORTB=0;
}
void shift_1_bit(unsigned char LS)
{
if(LS) shift_data_1;
else shift_data_0;
clk_rising;
}
void shift_24_bit(int Red,int Green,int Blue)
{
unsigned char i;
le_high;
for (i=0;i<8;i++)
{
if ((Green<<i)&0x80) shift_1_bit(1);
else shift_1_bit(0);
}
for (i=0;i<8;i++)
{
if ((Red<<i)&0x80) shift_1_bit(1);
else shift_1_bit(0);
}
for (i=0;i<8;i++)
{
if ((Blue<<i)&0x80) shift_1_bit(1);
else shift_1_bit(0);
}
le_low;
}
More info about “3W RGB LED strip” http://www.seeedstudio.com/depot/3w-rgb-led-strip-common-anode-12v-p-351.html


July 25, 2009 - 3:03 pm
If I try to upload the code using Arduino IDE,
I get this error:
+++++++++++++++++++++++
In function ‘void setup()’:
error: ‘open_all_line’ was not declared in this scope In function ‘void shift_1_bit(unsigned char)’:
+++++++++++++++++++++++
I’ve copied the “Rainbow.h” file inside the sketch folder, but it looks like something is missing?
And another question regarding the led strips:
do they still work with 5v or require 12v to see something?
Sorry if these are stupid questions,
I’m trying to learn,
thanks,
kk
Agree or Diagree
0
0
July 27, 2009 - 7:29 pm
got it, library should be copied to arduino libraries folder: succedeed uploading the file and making the led strips work with 12v…
best,
kk
Agree or Diagree
0
0
August 6, 2009 - 10:04 am
and turns out that my Arduino board is equipped with ATMEGA8, that has not enough shitness for all the pwm wonders going on.
For anyone interested in knowing more, check this page that explain the differences between ATMEGA 8-168 :
http://arcfn.com/2009/07/secrets-of-arduino-pwm.html
Agree or Diagree
0
0