Hi, I am quite new to Arduino, I have encountered a problem which is "Two or more data types in declaration of 'loop'" I have searched and I have seen that it is a problem of conflicting data types for a variable, I have tried fixing it but to no luck. I need help finding what could be the culprit behind this.
#include<LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
const int mm[60] = {
00, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59 }; //array for minute values
const int hour[] = {
1, 2, 3, 4, 5, 6,7, 8, 9,10,11,12 }; //array for hour values
const int ss[60] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59 }; //array for second values
int ampdet=1; //determines whether it is AM or PM; can be adjusted to make it PM or AM:set to 2 for PM, set to 1 for AM
int seconds=0; //adjustments for seconds made on the for loop for the seconds
int minutes=58; //can be used to set the minutes
int hours=9; //can be used to set the hours; the hours is plus 1 from here, typing 0 here constitutes a 1 on the LCD, the 0 is config time, the 1 is LCD time
int day=6; //can be used to set the day
/*
0-Monday
1-Tuesday
2-Wednesday
3-Thursday
4-Friday
5-Saturday
6-Sunday
*/
int LCDhours;
int x;
int SecretCounter;
int
void setup() {
int LCDhours=hours+1;
int x=0;
if(ampdet % 2 == 0)
{
x=12;
x==12;
}
SecretCounter = LCDhours + x; //IMPORTANT: ADJUST IF ADJUSTING THE CLOCK, WILL NOT WORK IF THIS IS NOT ADJUSTED.
//TO ADJUST:TAKE LCD HOUR(NOT THE CONFIG)
//IF PM: ADD 12 TO LCD HOUR=SECRETCOUNTER VALUE
//IF AM: AS IS
lcd.begin(16,2);
lcd.setCursor(1,1);
lcd.print("M");
lcd.setCursor(5,1);
lcd.print(":");
}
void loop() {
lcd.setCursor(6,1);
lcd.print(mm[minutes]);
lcd.setCursor(3,1);
lcd.print(hour[hours]);
if(ampdet % 2 ==0 )
{
lcd.setCursor(0,1);
lcd.print("P");
}
if(ampdet % 2 ==1 )
{
lcd.setCursor(0,1);
lcd.print("A");
}
switch(day)
{
case 0:
lcd.setCursor(0,0);
lcd.print(" ");
lcd.setCursor(0,0);
lcd.print("Monday");
break;
case 1:
lcd.setCursor(0,0);
lcd.print(" ");
lcd.setCursor(0,0);
lcd.print("Tuesday");
break;
case 2:
lcd.setCursor(0,0);
lcd.print(" ");
lcd.setCursor(0,0);
lcd.print("Wednesday");
break;
case 3:
lcd.setCursor(0,0);
lcd.print(" ");
lcd.setCursor(0,0);
lcd.print("Thursday");
break;
case 4:
lcd.setCursor(0,0);
lcd.print(" ");
lcd.setCursor(0,0);
lcd.print("Friday");
break;
case 5:
lcd.setCursor(0,0);
lcd.print(" ");
lcd.setCursor(0,0);
lcd.print("Saturday");
break;
case 6:
lcd.setCursor(0,0);
lcd.print(" ");
lcd.setCursor(0,0);
lcd.print("Sunday");
break;
case 7:
lcd.setCursor(0,0);
lcd.print(" ");
lcd.setCursor(0,0);
lcd.print("Monday");
day==0;
day=0;
break;
}
for(seconds=0;seconds<60;seconds++)
{
lcd.setCursor(9,1);
lcd.print(ss[seconds]);
delay(1000);
}
lcd.setCursor(10,1);
lcd.print(" ");
seconds==0;
minutes++;
if(minutes==60)
{
hours++;
SecretCounter++;
lcd.setCursor(7,1);
lcd.print(" ");
minutes==0;
minutes=0;
}
if(hours==11 && minutes==0)
{
ampdet++;
}
if(hours==12 )
{
lcd.setCursor(4,1);
lcd.print(" ");
hours==0;
hours=0;
}
if(SecretCounter == 24)
{
day++;
SecretCounter==0;
SecretCounter=0;
}
}
I could not find any conflicts anywhere, which may be due to my lack of experience.
Any and all help would be much appreciated