so i want to make this spaceship interference project from the arduino starter book but when i tried coding i get this error compling problem
here is the code
void setup(){ } void loop(){ } int switchState = 0; void setup(){ pinMode(3,OUTPUT); pinMode(4,OUTPUT); pinMode(5,OUTPUT); pinMode(2,INPUT); } void loop(){ switchState = digitalRead(2); //this is a comment if (switchState == LOW) { //the button is not pressed digitalWrite(3, HIGH); // green LED digitalWrite(4, LOW); // red LED digitalWrite(5, LOW); // red LED } else { // the button is pressed digitalWrite(3, LOW); digitalWrite(4, LOW); digitalWrite(5, HIGH); delay(250); //wait for a quarter second //toggle the LEDs digitalWrite(4, HIGH); digitalWrite(5, LOW); delay(250); // wait for a quarter second
} } // go back to the beggining of the loop
here is the error message: Arduino: 1.6.5 Hourly Build 2015/05/15 06:16 (Windows 7), Board: "Arduino Uno"
sketch_may19a.ino:1:21: fatal error: Arduino.h: No such file or directory compilation terminated. Error compiling.
This report would have more information with "Show verbose output during compilation" enabled in File > Preferences.
SMDH!
Is that how you have the program in the IDE? Go look at some example codes and see if you can see how a typical program is laid out. HINT: It's never all jammed into one line.
int switchState = 0;
void setup(){
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(2,INPUT);
}
void loop(){
switchState = digitalRead(2);
//this is a comment
if (switchState == LOW) {
//the button is not pressed
digitalWrite(3, HIGH); // green LED
digitalWrite(4, LOW); // red LED
digitalWrite(5, LOW); // red LED
}
else { // the button is pressed
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
delay(250); //wait for a quarter second
//toggle the LEDs
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
delay(250); // wait for a quarter second
}
} // go back to the beggining of the loop
haha i am sorry man here is it
There aren't any errors in that code. It compiles fine on my machine.
It's complaining that it can't find the header Arduino.h
That's odd and may mean that the IDE didn't install correctly. You might reinstall the IDE and see what happens. Have you been able to compile any other code?
nope it my first ever writing a code
i ll reinstall it and see
Delta_G:
There aren't any errors in that code. It compiles fine on my machine.
It's complaining that it can't find the header Arduino.h
That's odd and may mean that the IDE didn't install correctly. You might reinstall the IDE and see what happens. Have you been able to compile any other code?
thanks alot it did upload now thanks bud