Menu and display conflicts.

I am having a conflict with my menu and my display. When I enter into the set time for my clock(yes it is a school project). The temperature and humidity readings stay display on the 2nd line, but the graphics do not. everything works except this on thing. any guidance would be greatly appreciated. I am using a mega 2560 board. Code is attached.

Alarm_Clock_final.ino (8.68 KB)

Question: when do you display those special characters?
Answer: In the setup() function that is called only once

Question: Do you ever clear the display inside loop()?
Answer: Yes.

hmmmmm.

float pressLength_milliSeconds = 0;

You are not ever determining a number of milliseconds for this variable. You assign it only integral values, so float is the wrong type.

void loop()



{ while (digitalRead(buttonPin) == LOW)

You have too much useless white space in some places, and far too little in other places.

NOTHING follows a { on the same line.

  delay(1000);

Why? If you are going to do something stupid, you should document why you are doing the stupid thing.

  if (menu==0)
    {
     DisplayDateTime(); // void DisplayDateTime
     Alarm(); // Alarm control
          }

Your indenting sucks. Use Tools + Auto Format if you are too lazy to properly indent your code as you write it.

  if (menu==0)
  if (menu==1)
  if (menu==2)
  if (menu==3)
  if (menu==4)
  if (menu==5)
  if (menu==6)

How many of these if statements will evaluate to true, on any given pass through loop()? When the answer is "Not more than one", use if/else ifs, not a series of ifs.

  lcd.print(now.hour(), DEC);

It is useful to understand how many arguments a function takes, and what those arguments mean, and what default values, if any, those arguments have.

int hourupg;
int minupg;
int yearupg;
int monthupg;
int dayupg;

I can't tell what universe you are in, but in my universe, there are no negative hours, minutes, years, months, or days, and no months with more than 255 days, no years with more than 255 months, and no hours with more than 255 minutes.

You may not be having memory problems yet, but keep wasting memory and you WILL have problems.

Hi,

Indentation Style

If else

Switch Statement

Functions

Variable types

Data types (arduino):

Int

Byte

Float

cpp comments

blh64:
Question: when do you display those special characters?
Answer: In the setup() function that is called only once

Question: Do you ever clear the display inside loop()?
Answer: Yes.

hmmmmm.

Thanks for help,
I got it working this morning. Guess I just needed a reboot.