const byte buttonPin = ; // the pin the switch is connected to
const bye LEDPin = ; // the pin the LED is connected to.
void setup ()
{
pinMode (buttonPin, INPUT);
digitalWrite (buttonPin, HIGH);
pinMode (LEDPin, OUTPUT);
}
void loop ()
{
digitalWrite (LEDPin, digitalRead (buttonPin));
}
Connect your switch between your input pin and ground.
Don't forget a resistor for your LED (you didn't say how it is wired, I'm assuming between the output pin and ground)