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?

The Guy with The Hat
5,2927 gold badges30 silver badges51 bronze badges
asked Aug 6, 2014 at 12:34

3 Answers 3

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!

jfpoilpret
9,1627 gold badges38 silver badges54 bronze badges
answered Aug 6, 2014 at 13:58
1
lcd.setCursor(0, 1);
lcd.print("Launch in ");
lcd.print(millis()/1000);
answered Aug 6, 2014 at 13:56
1
  • 2
    Can you add why the original code didn't work? Answers are best if they have some explanation, not just code. Commented Aug 6, 2014 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.

answered Aug 6, 2014 at 13:56

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.