You can also use this code to setup an LED with a button switch with a pull up resistor, this could preferably be with the next step after setting up the intial LED controller
int buttonState = 0; // variable for reading the pushbutton status
void setup()
{
// initialize the LED pin as an output:
pinMode(13, OUTPUT); // You can set it just using its number
// initialize the pushbutton pin as an input:
pinMode(2, INPUT);
}
void loop()
{
// read the state of the pushbutton value:
buttonState = DigitalRead(2);
// check if the pushbutton is pressed.
// If it's not, the buttonState is HIGH : if (buttonState == HIGH)
{
// turn LED off:
digitalWrite(13, LOW);
}
else
{
// turn LED off:
digitalWrite(13, HIGH);
}
}