1

I want the bottom row of my LCD to display the counting function and include text:

lcd.setCursor(0, 1);
lcd.print("Launch in"millis()/1000);

But it comes out with an error, what part is wrong?

1

The last line in the code you provided won't compile.

The lcd.print() function expects a char, byte, int, long or string (taken from the LiquidCrystal docs) and you're trying to combine a string and an int which the compiler isn't going to understand.

The easiest way to print both would be to have two lcd.print statements:

lcd.print("launch in ");
lcd.print(millis()/1000);

Most of this is taken from quickly googling displaying time on an lcd screen. Check out this forum post, it seems similar to what you want to do: click me!

1
lcd.setCursor(0, 1);
lcd.print("Launch in ");
lcd.print(millis()/1000);
1
  • 2
    Can you add why the original code didn't work? Answers are best if they have some explanation, not just code. Aug 6 '14 at 16:58
1

Change the last line to:

lcd.print("Launch in " + (millis() / 1000));

The + concatenates the string Launch in with the number that results from millis() / 1000.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.