i am trying to get it to turn the LED on when i press the button and have it remain on until i press the off button.
it works just fine with pin 9, it turns on and remains on until i press the off button. but when i press any other buttons the LED only stays on while i am holding the button and turns off when i release it.
what am i missing here
any and all suggestions and help is welcome, im new to this...
void setup() {
// put your setup code here, to run once:
pinMode(9,INPUT);
pinMode(10,INPUT);
pinMode(11,INPUT);
pinMode(12,INPUT);
pinMode(14,OUTPUT);
pinMode(15,OUTPUT);
pinMode(16,OUTPUT);
pinMode(17,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(9)==HIGH)
digitalWrite(14,HIGH);
if (digitalRead(12) == HIGH)
digitalWrite(14, LOW);
digitalWrite(15, LOW);
digitalWrite(16, LOW);
Which lines of code will be executed if pin 12 is HIGH ?
Which lines will be executed whatever the state of pin 12 ?
Are the line of code being executed the ones that you want ?
Note the code tags used when I pasted the code and also the code formatting when I used Tools/Auto Format in the IDE