So i was just programming something like an alarm clock and everything was working fine and then suddenly i get an error that for some reason disables the LiquidCrystal library. (I think this is what happens anyways as i get an error for everything with lcd. or LiquidCrystal in it)
Sorry for posting whole code but i dont know what to remove to make it shorter.
Error msg:
Arduino: 1.6.1 (Windows 8.1), Board: “Arduino Uno”
In file included from Alarm_Clock_Project.ino:19:0:
C:\Program Files (x86)\Arduino\libraries\LiquidCrystal\src/LiquidCrystal.h:45:1: error: expected ‘,’ or ‘;’ before ‘class’
class LiquidCrystal : public Print {
^
Alarm_Clock_Project.ino:20:1: error: ‘LiquidCrystal’ does not name a type
Alarm_Clock_Project.ino: In function ‘void setup()’:
Alarm_Clock_Project.ino:32:3: error: ‘lcd’ was not declared in this scope
Alarm_Clock_Project.ino: In function ‘void loop()’:
Alarm_Clock_Project.ino:50:3: error: ‘lcd’ was not declared in this scope
Alarm_Clock_Project.ino: In function ‘void minute()’:
Alarm_Clock_Project.ino:75:7: error: ‘lcd’ was not declared in this scope
Alarm_Clock_Project.ino: In function ‘void hour()’:
Alarm_Clock_Project.ino:86:7: error: ‘lcd’ was not declared in this scope
Alarm_Clock_Project.ino:93:7: error: ‘lcd’ was not declared in this scope
Error compiling.
This report would have more information with
“Show verbose output during compilation”
enabled in File > Preferences.
const int button1=6;
const int button2=7;
const int button3=8;
const int button4=9;
int zero = 0;
int y = 0;
int x = 0;
int z = 0;
const int secondchange=60;
const int minutechange=60;
const int hourchange=24;
const int buzzerpin = 13;
int changeState = 0
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
Serial.begin(9600);
pinMode(button1, INPUT);
pinMode(button2, INPUT);
pinMode(button3, INPUT);
pinMode(button4, INPUT);
pinMode(buzzerpin, OUTPUT);
lcd.begin(16, 2);
lcd.clear();
lcd.setCursor(0,1);
lcd.print("test");
}
void loop() {
int button1State, button2State, button3State;
button1State = digitalRead(button1);
button2State = digitalRead(button2);
button3State = digitalRead(button3);
Serial.print(y);
second();
minute();
hour();
lcd.setCursor(0,0);
lcd.print(z);
lcd.setCursor(3,0);
lcd.print(":");
lcd.setCursor(4,0);
lcd.print(x);
lcd.setCursor(7,0);
lcd.print(":");
lcd.setCursor(8,0);
lcd.print(y);
State();
}
void second(){
delay(1000);
++y;
}
void minute(){
if (y == 60)
{
++x;
y = 0;
lcd.setCursor(9,0);
lcd.print(" ");
}
}
void hour(){
if (x == 60)
{
++z;
x = 0;
lcd.setCursor(4,0);
lcd.print(" ");
}
if (z == 24)
{
z = 0;
lcd.setCursor(0,0);
lcd.print(" ");
}
}
void State(){
int button1State, button2State, button3State;
button1State = digitalRead(button1);
button2State = digitalRead(button2);
button3State = digitalRead(button3);
if (button1State == LOW)
{
changeState = 1;
}
else
{
changeState = 0;
}
if ((changeState == 1) && (button1State == LOW))
{
changeState = 2;
}
else
{
changeState = 1;
}
}