oi,sou novato na programação em arduino e ao compilar este programa dá erro será que me poderiam resolver a questão desde já obrigada.
// this constant won't change:
const int buttonPin = 5; // the pin that the pushbutton is attached to
// Variables will change:
int buttonState = 0; // current state of the button
int lastButtonState = 0; // previous state of the button
void setup() {
// initialize the button pin as a input:
pinMode(buttonPin, INPUT);
// initialize serial communication:
Serial.begin(9600);
}
void loop() {
// read the pushbutton input pin:
buttonState = digitalRead(buttonPin);
// compare the buttonState to its previous state
if (buttonState != lastButtonState) {
if (buttonState == HIGH) {
// if the current state is HIGH then the button
// wend from off to on:
Serial.println("Headlights");
delay (1000);
}
}
buttonState = digitalRead(buttonPin2);
if (buttonState != lastButtonState) {
// if the state has changed, increment the counter
if (buttonState == HIGH) {
// if the current state is HIGH then the button
// wend from off to on:
Serial.println("Windshield Wipers");
delay (1000);
}
}
buttonState = digitalRead(buttonPin3);
if (buttonState != lastButtonState) {
// if the state has changed, increment the counter
if (buttonState == HIGH) {
// if the current state is HIGH then the button
// wend from off to on:
Serial.println("Pit Speed Limiter");
delay (1000);
}
}
buttonState = digitalRead(buttonPin4);
if (buttonState != lastButtonState) {
// if the state has changed, increment the counter
if (buttonState == HIGH) {
// if the current state is HIGH then the button
// wend from off to on:
Serial.println("Start Engine");
digitalWrite(led, HIGH);
//delay (10);
digitalWrite(led, LOW);
}
}
// save the current state as the last state,
//for next time through the loop
lastButtonState = buttonState;
}