lcd_putchar and lcd_init_printf() and 8 char limit


I am using lcd_init_printf() and printf and noticed that printf only prints 8 characters on the 16x2 lcd display. I looked at lcd_putchar (fdevopen redirects printf output to lcd_putchar) and indeed it looks like it has a max length 8 characters per line.

Any reason for the limit? Was it originally intended for a smaller display?

BTW, I like the SVP-1284 and the hardware & software functions you provided, nice platform.


Hello, Mike.

The OrangutanLCD library was originally designed for our older Orangutan controllers (and the 3pi robot) which all have 8x2 character displays. When I was updating the Pololu AVR C/C++ library for the Orangutan SVP I overlooked changing lcd_putchar.

Attached to this post is a replacement OrangutanLCD.cpp file you can use (after removing the fake .doc extension). You can recompile the library yourself with this file and install that version. We will also incorporate this fix in to the next release of the library.

If you don’t want to compile the library, you could also use all 16 columns of your LCD with functions like print, print_from_program_space, print_long, print_hex, and lcd_goto_xy instead of printf.

OrangutanLCD.cpp.doc (18.1 KB)

I ended up using sprintf(buf,…) and then print(buf). Right now I am just prototyping to get familiar with various sensors and eventually will get away from printf, floats, etc.

I’ll rebuild the libs with the update as you suggested.