3 years, 7 months ago.

writing to each line of a 2-line LCD display

how do I write to each line of a 16X2 LCD display?

If I do: lcd.printf("Hello World \n"); and then: lcd.printf("Hello again \n"); anfd then: lcd.printf("Hello a 3rd time\n");

Does the LCD write on the two lines of the 16X2 display and then go back to the top and write the third line?

Jim

Question relating to:

Hi ! I have a problem with this program, there is the Error: #error directive: "CMSIS Target not recognised" in "extras/mbed_e2ac27c8e93e/cmsis.h", did you have this problem ? Thanks ! Emilie

posted by projet 73 07 Mar 2016

I see you use the NUCLEO-L053R8. This is a relatively new platform. In case you just imported the example program and library it may still have an older version of the mbed lib that did not support the L053 at the time of writing. Try to click right mouse button on the mbed lib in your program space and select ''update''. Then recompile all.

posted by Wim Huiskamp 07 Mar 2016
Comment on this question

1 Answer

3 years, 7 months ago.

Yes, every time a '\n' is encountered the cursor moves to start of the next line. The cursor will jump back to the first line when you reached the last available line. The cursor will also move to the next line when you print more chars than fit on the current line. So when you execute lcd.printf("Hello a 3rd time\n") it will actually do two newlines (16 chars + '\n') and end up on the same line when you are using a 16x2 line display!

Hi ! I have a problem with this program, there is the Error: #error directive: "CMSIS Target not recognised" in "extras/mbed_e2ac27c8e93e/cmsis.h", did you have this problem ? Thanks ! Emilie

posted by projet 73 07 Mar 2016

You need to log in to post a question