Hello seeeders,
summer holidays, what’s best than waste all of my free time in learning electronics?
I’m trying to replicate the 12V LED experiment in the seeedblog, but with RGB leds instead of strips:
http://www.seeedstudio.com/blog/?p=512
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)’:
If I open “Rainbow.h” file, there’s nothing defining ‘open_all_line’.
What should I write in “Rainbow.h” to make it work?
For the moment I manually opened all the lines in the sketch setup,
see the attached code.
And I suppose there are some syntax error or something weird,
because I had to fix some brackets in the “for” loops
to make the code compile correctly in the Arduino IDE.
I don’t know if I am missing some major thing,
in case please pardon my naivity,
best,
kk
This is the version with “open_all_line” translated into open_line(0-7), it is correctly compiled by Arduino IDE:
[code]
//12v SMD led strips control from SEEEDstudio website:
//the function “open_all_lines” is not defined in Rainbow.h
#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
open_line0;open_line1;open_line2;open_line3;open_line4;open_line5;open_line6;open_line7;
}
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;
}[/code]