I'm trying to create a device that will take 1 of 4 buttons and either start a 40 sec timer, 25 sec timer, 60 sec timer, or "reset" the timer. LED will illuminate once button is pushed until the timer expires. At 30/25 sec remaining in the 60/40 sec timer it will trigger a vibration buzzer for a short amount of time/bursts. When all timers expire the buzzer will go off for 3 sec to let you know it has expired. I am coming from (very basic, 1 semester of college) Java and I think I have everything software wise worked out, except I am getting "expected unqualified-id before" errors and "note: in expansion of macro HIGH" Any advice/help that could be provided would be greatly appreciated.
int fortyButton = 4; // pin for forty second clock
int twentyfiveButton = 5; // pin for 25 second clock
int resetButton = 6; // pin for reset button
int sixtyButton = 3; // pin for reset button
int controlPin = 2; // pin to control LED
int buzzerPin = 1; // pin to control buzzer
unsigned long timerCount = 0;
void setup() {
pinMode(fortyButton, INPUT); //set pin as receiving pin
pinMode(twentyfiveButton, INPUT); //set pin as receiving pin
pinMode(resetButton, INPUT); //set pin as receiving pin
pinMode(sixtyButton, INPUT); //set pin as receiving pin
digitalWrite(controlPin, LOW); //starting the control power as off
digitalWrite(buzzerPin, LOW); //starting the buzzer power as off
}
void loop() {
//40 second button code
if (digitalRead(fortyButton) = HIGH) //if forty button pushed
{
timerCount = 40 * 10; // set timer to 40 seconds
{
if (timerCount != 0)
;
digitalWrite(controlPin, HIGH); //power LED
timerCount = timerCount - 1;
delay(100); //1 decisecond delay
}
{
if (timerCount = 2500)
; // if timer hits 25 seconds
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(300); //wait 3/10 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(300); //wait 3/10 of a sec
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(300); //wait 3/10 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(300); //wait 3/10 of a sec
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(300); //wait 3/10 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(300); //wait 3/10 of a sec
}
{
if (timerCount = 500)
; // if timer hits 35 seconds
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(500); //wait 1/2 of a sec
}
} else { //if timer has run out
digitalWrite(controlPin, LOW); //Shutoff LED
digitalWrite(buzzerPin, HIGH); //Start Buzzer
delay(3000); // power buzzer for 3 sec
digitalWrite(buzzerPin, LOW); //turn buzzer off
}
}
//25 second button code
if (digitalRead(twentyfiveButton) = HIGH) // if 25 sec button is pushed
{
timerCount = 25 * 10; //set timer to 25 seconds
{
if (timerCount != 0)
;
digitalWrite(controlPin, HIGH); //power LED
timerCount = timerCount - 1;
delay(100); //1 decisecond delay
}
{
if (timerCount = 500)
; // if timer hits 35 seconds
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(500); //wait 1/2 of a sec
}
} else { //if timer has run out
digitalWrite(controlPin, LOW); //Shutoff LED
digitalWrite(buzzerPin, HIGH); //Start Buzzer
delay(3000); // power buzzer for 3 sec
digitalWrite(buzzerPin, LOW); //turn buzzer off
}
//60 second code
if (digitalRead(sixtyButton) = HIGH) // if sixty button pushed
{
timerCount = 60 * 10; // set timer to 60 seconds
{
if (timerCount != 0)
;
digitalWrite(controlPin, HIGH); //power LED
timerCount = timerCount - 1;
delay(100); //1 decisecond delay
}
{
if (timerCount = 3000)
; // if timer hits 30 seconds
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(300); //wait 3/10 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(300); //wait 3/10 of a sec
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(300); //wait 3/10 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(300); //wait 3/10 of a sec
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(300); //wait 3/10 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(300); //wait 3/10 of a sec
}
{
if (timerCount = 500)
; // if timer hits 35 seconds
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, HIGH); //turn on buzzer
delay(500); //wait 1/2 of a sec
digitalWrite(buzzerPin, LOW); //turn off buzzer
delay(500); //wait 1/2 of a sec
}
else { //if timer has run out
digitalWrite(controlPin, LOW); //Shutoff LED
digitalWrite(buzzerPin, HIGH); //Start Buzzer
delay(3000); // power buzzer for 3 sec
digitalWrite(buzzerPin, LOW); //turn buzzer off
}
}
if (digitalRead(resetButton) == HIGH) //if reset button is pushed
timerCount = 0;
digitalWrite(controlPin, LOW); //turn off the LED
}