lcd.print question.

ive done it before i know im just being a plum about this,

basically i have a score which i want to print to the LCD

i no i can use the following command to print the output to the lcd

    lcd.print(Team2count);

but what i really want is

"Team 1, OUTPUT HERE"

and i was pretty sure i used the following before to accomplish this

 lcd.print("TEXT", Team2count);

or something along them lines, can anyone point me in the right direction please/.

Why not consult the reference?

i have had a look on the following page

https://www.arduino.cc/en/Reference/LiquidCrystalPrint

which references what i thought was correct,

lcd.print(data, BASE)

lcd.print(data, BASE)
data is a number.

This is used to print numbers in a specific format.
Example: base can be DEC (decimal), HEX (hexadecimal), BIN (binary) and OCT (octal).

I think what you are asking is something that sprintf() offers.

http://www.cplusplus.com/reference/cstdio/printf/
Excluding float from the last URL.

Just a wild suggestion but how about

lcd.print("Team 1 ");
lcd.print(Team1count);

UKHeliBob wont that print it on 2 seperate lines i need it to print on the same line

Hi,

lcd.print("Team 1 ");
lcd.print(Team1count);

Why don't you be adventurous and try it.
Give Team1count a value.

Tom....... :slight_smile:

mathewbuer:
UKHeliBob wont that print it on 2 seperate lines i need it to print on the same line

As Tom has pointed out it is easy for you to experiment and find out.

For bonus points you could position the cursor exactly where you need it before each print statement and leave out the trailing space on the text.

To reach SuperStar status try printing a score of 99 then later a score of 1 without the screen showing an apparent score of 19.

None of this requires more than a few lines of test code before you incorporate the solution into a larger program.

Thanks guys :slight_smile: