Please can anyone help me, and tell why this program will not work, it downloads fine.
const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
unsigned long time;
unsigned long current_time;
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
int set_pressed = 0;
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
digitalWrite(ledPin, LOW);
}
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 && set_pressed == LOW )
set_pressed == HIGH;
time = millis();
{
current_time = millis();
if ((current_time - time) >= 1000 && set_pressed == HIGH)
digitalWrite(ledPin,HIGH);
} // turn it on when its been running for a second
{
current_time = millis();
if ((current_time - time) >= 4000 && set_pressed == HIGH)
set_pressed == LOW;
digitalWrite(ledPin,LOW);
} // turn it off when its been running for 4seconds
}