function not declared in scope


this program (not finished can see):
code: [select]

// constants
const char state_default  = 'a';

// environment variables
long currenttime = 0;
char state = state_default;
int redinterval   = 0;
int blueinterval  = 0;
int greeninterval = 0;
long redstarttime   = 0;
long bluestarttime  = 0;
long greenstarttime = 0;

void setup()
{
 serial.begin(9600);
 setcolorinterval(redstarttime, redinterval);
 setcolorinterval(bluestarttime, blueinterval);
 ssetcolorinterval(greenstarttime, greeninterval);
}

void loop()
{
}

void setcolorinterval(long &starttime, int &interval, int mininterval, int maxinterval)
{
 if((starttime == 0) || (currenttime - starttime >= interval))
 {
   interval = random(mininterval, maxinterval);
   starttime = currenttime;
 }
}

void setcolorinterval(long &starttime, int &interval)
{
 setcolorinterval(starttime, interval, 0, 10000);
}


when compile code "in function 'void setup()': error: 'setcolorinterval' not declared in scope".
even when move function call setup loop() still gives me error loop. why getting error?

setcolorinterval defined after call it, in either setup or loop.

move function up, before setup and/or loop, , problem go away.


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > function not declared in scope


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums