I created a small program on the Arduino coding platform and it compiles fine, but when it is tested on my breadboard it does not work. I think that I messed up somewhere in the coding since i'm a beginner, anyway here is the code:
int lightA = 0;
int lightB = 0;
void setup(){
pinMode(13, INPUT);
pinMode(12, INPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
}
void loop(){
lightA = digitalRead(13);
lightB = digitalRead(12);
if (lightA == HIGH){
digitalWrite(8, HIGH);
digitalWrite(7, LOW);
}
if (lightB == HIGH){
digitalWrite(8, LOW);
digitalWrite(7, HIGH);
}
else{
digitalWrite(8, LOW);
digitalWrite(7, LOW);
}
}
If you can find what i'm doing wrong please post!