12V LED strip drives by Rainbowduino - PROBLEMS

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]

what is the close_all_line?
that just looks like bad code, like its missing something like () and a ; (semi-colon)

Hi atomriot!
From the little I can understand :blush: it’s a function defined in Rainbow.h,
in the same place where also “open_all_line” should be defined:

#define open_line0 {PORTB=0x04;}
#define open_line1 {PORTB=0x02;}
#define open_line2 {PORTB=0x01;}
#define open_line3 {PORTD=0x80;}
#define open_line4 {PORTD=0x40;}
#define open_line5 {PORTD=0x20;}
#define open_line6 {PORTD=0x10;}
#define open_line7 {PORTD=0x08;}
#define close_all_line {PORTD&=~0xf8;PORTB&=~0x07;}

I suppose the guys at seeed have a more advanced version of the library,
maybe they just forgot to update the released version…
but don’t really know, I’m trying to make my way thru this LED jungle.

I wait eagerly for an updated version of the library and some clearer examples,
maybe “better commented” library+examples could help even non-expert users to understand more:
I think the business target of seeed is pointing exactly toward enthusiast self-taught electronic experimenters like me,
and helping them a little more could be a wise decision, we’re not all engineers and what is obvious for experts often is hard to imagine for unexperienced people… just my 0.002 cents.

Thanks!
kk

Sorry for neglecting the question here , I am used to see the question on “Tech Support " and visit the” Suuggestions and complanints " seldom.

you can define the “#define open_all_line {PORTD|=0xF8;PORTB|=0x07;}” in Rainbow.h . And sorry for this negligence.

oops, heh. i came in last time with intent to move the topic, but ended up leaving a response. heh.

Topic NOW moved to support. :slight_smile: