Hello
i am a new one
So i try to learn the arduino language, and i work on a simple thing.
But this code have something wrong and i really don't know what. When i launch the arduino, just this code work
if ( a==1){
 digitalWrite(ledPin, HIGH );
 delay(100);
 digitalWrite(ledPin, LOW );
 delay(100);
 if (buttonState == HIGH) {
  // turn LED on:
  a=a+1;
 }
}
Like i click on the button and the write "if" work for a few seconds and after just this code work
const int buttonPin = 2;Â Â // the number of the pushbutton pin
const int ledPin =Â 13;Â Â Â // the number of the LED pin
// variables will change:
int buttonState = 0;Â Â Â Â // variable for reading the pushbutton status
int a=0;
void setup() {
 // initialize the LED pin as an output:
 pinMode(ledPin, OUTPUT);
 // initialize the pushbutton pin as an input:
 pinMode(buttonPin, INPUT);
 a=0;
}
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:
  a=a+1;
 }
 if (a==0){
  digitalWrite(buttonState, LOW );
  if (buttonState == HIGH) {
  // turn LED on:
  a=a+1;
  }
 }
if ( a==1){
 digitalWrite(ledPin, HIGH );
 delay(100);
 digitalWrite(ledPin, LOW );
 delay(100);
 if (buttonState == HIGH) {
  // turn LED on:
  a=a+1;
 }
}
 if (a==2){
  digitalWrite(ledPin, HIGH );
  delay(1000);
  digitalWrite(ledPin, LOW );
 delay(1000);
 if (buttonState == HIGH) {
  // turn LED on:
  a=a+1;
 }
 }
if (a==3) {
 digitalWrite(ledPin, HIGH);
 delay(1500);
 digitalWrite(ledPin, LOW);
 delay(100);
 if (buttonState == HIGH) {
  // turn LED on:
  a=a+1;
 }
if (a==4){
 a=0;
 if (buttonState == HIGH) {
  // turn LED on:
  a=a+1;
 }
}
}
}
Sorry for my English btw