bouton poussoir

Bonjour ,

Je cherche à faire un programme qui allume une led quand j'appuie sur un bouton poussoir et quand je rappuie sur ce bouton poussoir la led s'éteint.
J'ai essayé d'adapter le programme donné sur le site arduino (read a pushbutton, filtering noise http://arduino.cc/en/Tutorial/Debounce) mais mon code ne marche pas et je ne trouve pas mon erreur.

const int buttonPin = 30; // the number of the pushbutton pin
const int ledPin = 40; // the number of the LED pin

int buttonState; // the current reading from the input pin
int lastButtonState = LOW; // the previous reading from the input pin

long lastDebounceTime = 0;
long debounceDelay = 200;
int a=0;

void setup() {
pinMode(buttonPin, INPUT);
pinMode(ledPin, OUTPUT);
}

void loop() {

int reading = digitalRead(buttonPin);

if (reading != lastButtonState && reading == HIGH ) {

lastDebounceTime = millis();

}

if ((millis() - lastDebounceTime) > debounceDelay ) {

buttonState = reading;
}
if(buttonState==HIGH ){

if (a==0) {digitalWrite(ledPin, HIGH); a=1;
Serial.println("High");
}
else {digitalWrite(ledPin, LOW); a=0;
Serial.println("Low");}

}

lastButtonState = reading;

}

mais mon code ne marche pas

Et, il fait...quoi?

Quand j'appuie sur le bouton poussoir la led passe d'un état haut à un état bas très rapidement(on voit donc la led à moitié allumé ) et quand je relache la led passe en etat bas ou en état haut mais sans aucune logique

Google "floating pin" or "floating input"

J'ai bien mis une masse flottante je pense que le problème est plutot informatique

Sorry, my technical French isn't up to this.
A floating ground?
Do you have an external pull-down resistor?
In other words, how is pin 30 connected?

yes i have one