Best underscore cusror method when using LCD4Bit?

n00b here.

Using the LCD4Bit library for a sketch and it doesn't appear to have an underscore cursor option.

What is the best way to implement an underscore cursor when using this library?

Thank you mucheroo!


Using the LCD4Bit library for a sketch...

This library is somewhat obsolete, but if it is working for you I guess there's no reason to change.

it doesn't appear to have an underscore cursor option

It does appear to have a function to write a command, which is what you need to do.

The specific command you need is the one called 'Display On/Off Control' on the LCD data sheet. Normally, during LCD initialization this is written as 0x0C (or 0b00001100) which turns the display ON and the cursor OFF.

You want to tinker with the lower two bits. I believe that 0b00001110 (0x0E) will give you a blinking underscore and 0b00001101 (0x0D) will give you a blinking box (or blinking character). I don't think you can get a steady underscore.

You do not have to change the initialization steps. Just send this command whenever you want to add the cursor. It will 'stick' until you deliberately turn the cursor off with another 'Display On/Off Control' command.


Looks good, will check it out.

Assuming if I throw a cursorTo(location) prior it will blink under that character. I for some reason thought you had to tell the cursor to go on and off to blink.

I would still recommend looking into the liquidcrystal library for whatever it is you are doing. Even if it takes a bit more work it will probably be worth your while.


It is quite a bit of code to change. What are the reasons to move from the LCD4Bit library to the LiquidCrystal library?

Thanks for all your help! :sunglasses: