Ok thank you, so here is the new code
//The goal of this is to have a stopwatch on the LCD, and I want to press a button and If the stopwatch is at a time greater or equal to 120 then the LCD says a message.
//If the stopwatch is less than 120 when the button is pressed then it displays a different message.
#define BUTTON_PIN 7
#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
pinMode(BUTTON_PIN 7, INPUT);
lcd.print ("Tooth Brushing Time");
}
void loop() {
lcd.setCursor(0, 0);
lcd.print("SW (ss:)");
lcd.setCursor(0, 1);
lcd.print(" ");
unsigned long durSS = (elapsedMillis/1000); //Seconds
}
if (buttonstate == HIGH)
if (unsigned long durSS >=w 120000Millis/1000) {
lcd.print("Good Job! You did it!")
}
else {
if (buttonstate == HIGH)
if (unsigned long durSS < 120000Millis/1000)
lcd.print("Keep brushing, you are not there yet")
}
}
Theoretically it is supposed to make a stopwatch that displays different messages when you press a button and if the stopwatch is greater than or less than 120. I have been copying things from other code that I have found, but I am new to this coding so I don't know what it all really means. Here are the error messages:
Arduino: 1.8.19 (Windows 10), Board: "Arduino Uno"
C:\Users\nelso\Documents\Arduino\Toothbrushing\Toothbrushing.ino: In function 'void setup()':
Toothbrushing:10:22: error: expected ')' before numeric constant
pinMode(BUTTON_PIN 7, INPUT);
^
C:\Users\nelso\Documents\Arduino\Toothbrushing\Toothbrushing.ino: In function 'void loop()':
Toothbrushing:18:28: error: 'elapsedMillis' was not declared in this scope
unsigned long durSS = (elapsedMillis/1000); //Seconds
^~~~~~~~~~~~~
C:\Users\nelso\Documents\Arduino\Toothbrushing\Toothbrushing.ino: At global scope:
Toothbrushing:20:3: error: expected unqualified-id before 'if'
if (buttonstate == HIGH)
^~
Toothbrushing:24:3: error: expected unqualified-id before 'else'
else {
^~~~
Toothbrushing:29:1: error: expected declaration before '}' token
}
^
exit status 1
expected ')' before numeric constant
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.