Experiment 2 - Button

In this experiment you will connect a button and get the LED to light up when it's pressed.

Circuit

Wire up the experiment as shown in fig.1. fig.1

Code

In the Arduino IDE, create a new sketch and enter the following code:

int led = 13;

void setup() {                
  pinMode(led, OUTPUT);     
}


void loop() {
  digitalWrite(led, HIGH);  
}