The difference between lcd.write and lcd.print


I was wondering what is the difference between lcd.write(“SUP, DUDE”); and lcd.print(“SUP, DUDE”);

They seem to work just the same.

In the case of chars and char arrays, there is no difference.

If you wanted to print the number 65 to the screen then there would be, try: lcd.write(65); lcd.print(65);

What do you see happen?

(What you should see it that the first one prints the letter 'a', while the second prints "65")

The print function is there to condition what you give it into a series of printable charaters. So when you print the number 65, it takes it as meaning, "I want to print out the letter 6, then the letter 5". Whereas if you write the number 65, it says "I want to write a single byte with a value of 65" - 65 is the ascii value of 'a'.

Now try this: lcd.write((byte)0); //The (byte) is there to avoid compiler errors. lcd.print(0);