Hi :~,
I’m new to Arduino, I’ve recently invested some of my money into an Arduino Uno and some other starter equipment. I’m happy with my progress so far: I’ve read Massimo Banzi’s “Getting Started with Arduino (Make: Projects)” and have completed the first exercise to get an LED blinking. I’m on the second project where you learn how to control and LED with a pushbutton and am having some problems with the program. I can’t verify it
. I’ve written the program as follows:
#define LED 13 //the pin for the LED
#define BUTTON 7 //the input where the pushbutton is connected
int val=0; //val will be used to store the state of the pin
void setup()
{
** pinMode (LED, OUTPUT); //tell the Arduino LED is an output**
** pinMode (BUTTON, INPUT); //and BUTTON is an input**
}
void loop()
{
** val=digitalRead(BUTTON); //read input value and store it**
** //check whether the input is HIGH (button pressed)**
** if(val==HIGH_){**
** digitalWrite(LED, HIGH); //turn LED on**
** } else {**
** digitalWrite(LED, LOW);**
** }**
}
Whenever I try to verify it, it tells me that ‘HIGH’ was not declared in the scope and gives me the following error message:
“sketch_aug24a.ino: In function 'void loop()':
sketch_aug24a:13: error: 'HIGH_' was not declared in this scope”
Can anyone tell me what this means? Did I write the program incorrectly? I just want to know what I did wrong and how I can fix it, I’m going to continue to try to fix it myself, but any help would be greatly appreciated. :PThank you :).
-
SonomaComa