scope error not making sense
i following error in sketch (its first).
error: 'currentvalue' not declared in scope in function 'void loop()':
@ global scope:
here sketch in entirety (reads accelerometer data , puts on serial display (16x2)
its not done yet , needs other polishing...plus there no rush arduino's backordered @ sparkfun:
error: 'currentvalue' not declared in scope in function 'void loop()':
@ global scope:
here sketch in entirety (reads accelerometer data , puts on serial display (16x2)
its not done yet , needs other polishing...plus there no rush arduino's backordered @ sparkfun:
code: [select]
long highvalue=0.0;
long currentvalue=0.0;
void setup()
{
serial.begin(9600);
backlighton();
displaywelcome();
}
//in order 1.11 style output 2 ints required
// 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 (pin)
// \ \ \ \ \ \ \ | / / / / / / / (semi analog)
// 0 . 1 2 c u r | 0 . 1 3 h
void loop()
{
currentvalue=0.0;
int firstpart=0;
int secondpart=0;
currentvalue = getaccelvalue();
//split prettyfied output
firstpart = (int)(currentvalue);
secondpart = (int)(currentvalue * 100); //nothing expected beat 1g
selectlineone();
delay(100);
barchart(currentvalue);
selectlinetwo();
delay(100);
serial.print(firstpart);
delay(100);
serial.print(".");
delay(100);
serial.print(secondpart);
delay(100);
serial.print("cur/hi");
delay(100);
value=(getmaxvalue(currentvalue));
firstpart = (int)(currentvalue);
secondpart = (int)(currentvalue * 100); //nothing expected beat 1g
serial.print(firstpart);
serial.print(".");
serial.print(secondpart);
delay(300);
clearlcd();
}
void displaywelcome(){
selectlineone();
serial.print("danger the");
delay(100);
selectlinetwo();
delay(100);
serial.print("manifold!!!");
}
float getaccelvalue(){
return (random(1));
}
float getmaxvalue(currentvalue){
if (currentvalue > highvalue){
highvalue=currentvalue;
}
return (highvalue);
}
void barchart(currentvalue) {//makes simple bar chart on top line
}
void selectlineone(){ //puts cursor @ line 0 char 0.
serial.print(0xfe, byte); //command flag
serial.print(128, byte); //position
}
void selectlinetwo(){ //puts cursor @ line 0 char 0.
serial.print(0xfe, byte); //command flag
serial.print(192, byte); //position
}
void clearlcd(){
serial.print(0xfe, byte); //command flag
serial.print(0x01, byte); //clear command.
}
void backlighton(){ //turns on backlight
serial.print(0x7c, byte); //command flag backlight stuff
serial.print(157, byte); //light level.
}
void backlightoff(){ //turns off backlight
serial.print(0x7c, byte); //command flag backlight stuff
serial.print(128, byte); //light level off.
}
void sercommand(){ //a general function call command flag issuing other commands
serial.print(0xfe, byte);
}
probably because declare currentvalue (long) integer, assign floating point value in couple of places.
-j
-j
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > scope error not making sense
arduino
Comments
Post a Comment