DIY TV-B-Gone Test not working

The TV b gone, for those who do not know, is an ingenious device that uses an infrared led to turn off TV's, since virtually all TV remotes use infrared leds. I made a simplified version on my arduino: I wanted to test the IR led, so I used this code:

const int buttonPin = 2;     // the number of the pushbutton pin
const int ledPin =  3;      // the number of the LED pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);      
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT); 


void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // turn LED on:    
    digitalWrite(ledPin, 255);  

  else {
    // turn LED off:
    digitalWrite(ledPin, 0); 

This is basically the arduino pushbutton code, given on this website, with minor tweaks. However, when I run the code, the LED doesn't light up!!! Not when I release the button, or when I push the button!!! Frustrating!!!!

If it's wired as you show, you're getting the results you are because it's not seeing that the button is pushed

Assuming the button is normally closed, when button is not pressed, the pin is connected to ground... But when the button is pressed, the pin is... not connected to anything, and has no reason to go high. You need a pullup - you could use an external one, but it's easier to use the built-in pullup on the Arduino. Instead of INPUT, use INPUT_PULLUP mode.

    digitalWrite(ledPin, 255);

255? HIGH surely? 255 suggests analogWrite, not digitalWrite...