Error

Hallo,

Please some help…

I got the message “lcd” was not declared in this scope, see lowest syntax of the sketch

What can I dor to make this program run ??

regards Bob

zhtech@zhtech.nl

// http://www.vbotix.com/up-down-counter-using-arduino/

void setup()
{
// set up the LCD’s number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
// lcd.print(“Up-Down Counter”);
// Declare Switches as INPUT to Arduino
pinMode(sw1,INPUT);
pinMode(sw2,INPUT);
digitalWrite(sw1,HIGH);
digitalWrite(sw2,HIGH);
}

void loop()
{
if(digitalRead(sw1) == LOW) // if SW1 is pressed perform action described in loop
{
count++; // Increment Count by 1
lcd.setCursor(0, 1);
lcd.print(count);
delay(400);
}
if(digitalRead(sw2) == LOW) // if SW2 is pressed perform action described in loop
{
count–; // Decrement Count by 1
if(count < 0)
count = 0;
lcd.setCursor(0, 1);
lcd.print(count);
delay(400);
}

}
“lcd” was not declared in this scope

What can I dor to make this program run ??

include the lcd library and create an instance named lcd would seem to be a good idea.

Look at the Examples presented under the LCD library.