Hello All,
This piece of code (piece of larger reefcontroller code) is designed to alter the time of a DS1307 and putting it on a display
The line that needs to be changed on the display is:
23:12 31-08-12
For some reason it won't compile, and is giving me these errors:
EC_Aquacontrol_V0_05.cpp: In function 'void loop()':
EC_Aquacontrol_V0_05:874: error: expected (' before 'count' EC_Aquacontrol_V0_05:879: error: expected (' before 'count'
EC_Aquacontrol_V0_05:985: error: expected }' at end of input EC_Aquacontrol_V0_05:985: error: expected }' at end of input
EC_Aquacontrol_V0_05:985: error: expected }' at end of input EC_Aquacontrol_V0_05:985: error: expected }' at end of input
EC_Aquacontrol_V0_05:985: error: expected `}' at end of input
This means a fault somewhere between count 6 and 7, but I have looked it over countless times, and can't find it.
All the byte's and integers are declared in the code before this part.
Can somebody see what I am overlooking?
PS; if there is a more clever way of doing this, input is welcome ![]()
if (menuCount == 2) {
lcd.setCursor(0,0);
lcd.print("TIJD/DATUM INSTELLEN");
lcd.setCursor(2,1);
printHM(hour, minute);
lcd.print(" ");
lcd.print(dayOfMonth);
lcd.print("-");
lcd.print(month);
lcd.print("-");
lcd.print(year);
lcd.setCursor(11,3);
lcd.print("#=OPSLAAN");
lcd.setCursor(2,1);
lcd.blink();
char key = kpd.getKey();
while(key != '#') // Do until # is pressed
{
switch (key) {
case NO_KEY:
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
if count = 0; {
lcd.print(key);
lcd.moveCursorRight();
count++;
setHR = setHR * 10 + (key - '0');
if count == 2) {
lcd.moveCursorRight();
lcd.print(key);
count++;
setMN = setMN * 10 + (key - '0');
if (count == 4) {
lcd.moveCursorRight();
lcd.moveCursorRight();
lcd.print(key);
count++;
setDY = setDY * 10 + (key - '0');
if (count == 5) {
lcd.moveCursorRight();
lcd.print(key);
count++;
setDY = setDY * 10 + (key - '0');
if (count == 6) {
lcd.moveCursorRight();
lcd.moveCursorRight();
lcd.print(key);
count++;
setMT = setMT * 10 + (key - '0');
if (count == 7) {
lcd.moveCursorRight();
lcd.print(key);
count++;
setMT = setMT * 10 + (key - '0');
if (count == 8) {
lcd.moveCursorRight();
lcd.moveCursorRight();
lcd.print(key);
count++;
setYR = setYR * 10 + (key - '0');
if (count == 9) {
lcd.moveCursorRight();
lcd.print(key);
count++;
setYR = setYR * 10 + (key - '0');
if (count == 10) {
lcd.setCursor(2,1);
}
}
}
}
}
}
}
}
}
else {
}
break;
case '#':
setHR = hour;
setMN = minute;
setDY = dayOfMonth;
setMT = month;
setYR = year;
setDate(second, minute, hour, dayOfWeek, dayOfMonth, month, year);
count = 0;
lcd.noblink();
break;
}
}
backlightTime = millis();
}