/* Push-button and LED Circuit Connections: PIN_0 => LED_Anode - LED_Cathode = > Resistor 220Ω => Gnd PIN_4 => Pull-up resistor (built in) => push-button (Gnd) */ #define led_pin 0 //give the name “led_pin” to PIN_0 #define pb_pin 4 //give the name “pb_pin” to PIN_4 //The setup() function initializes and sets the initial values //It will only run once after each powerup or reset void setup() { //Configure PIN_0 to behave as outputs pinMode(led_pin, OUTPUT); //Configure PIN_4 to behave as input with activated pull-up resistor pinMode(pb_pin, INPUT_PULLUP); } //This function loops consecutively void loop() { //The LED follows the state of push-button digitalWrite(led_pin, digitalRead(pb_pin)); }