PUSH BUTTON AND LED FUN -ARM

Photo of author

By Jackson Taylor

Here on board led and push buttons are used .In this program when pressing push button led will be turn on void setup() {    pinMode(PF_0, INPUT_PULLUP); //push button 1    pinMode(PF_1,OUTPUT);        //blue led    pinMode(PF_4, INPUT_PULLUP); //push button 2    pinMode(PF_2,OUTPUT);        //red  led } void loop() {     if(digitalRead(PF_0)==0) //checks whether pushbutton 1 is on     digitalWrite(PF_1,HIGH); //turn on blue led ,if pushbutton 1 is pressed     else {digitalWrite(PF_1,LOW);}     if(digitalRead(PF_4)==0)  //checks whether pushbutton 2 is on     digitalWrite(PF_2,HIGH);  //turn on red led ,if pushbutton 2 is pressed     else {digitalWrite(PF_2,LOW);} }
See also
MARS PLANETARY ROVER WITH AUTOMATIC NAVIGATION