I'm working on a project where I'm trying to display the level of a filled tank through ultrasonic, then displaying it on a 16x2 LCD. I'm trying to do it through the whole LCD Pixels, such that when the tank level is full, the first 5 pixels are activated (as what happens when you connect the LCD initially without having any code for it, the whole pixels are turned on, giving 16x2 white rectangles, as shown in the picture below). Is there a way to activate an entire pixel on the LCD?
The LCD is made up from 32 characters each is 5x7 pixels in size, with a 1 pixel gap between each character.
You can never put anything in the gap between the characters, as there is just nothing there.
But what you can do is define your own characters to fit within the 5x7 pixel rectangles.
Some variants of the HD44780 have character 255 as a solid block, but not all (it depends on what language the ROM is). If you have one that has that character you can just print it with
lcd.write(255). If it doesn't it will print
ÿ instead. In that case you will have to define your own character.
One benefit of defining your own characters is that you could then do partial blocks to give you a higher resolution. Here's an example:
You can find that example and the code that goes with it here.
The LCDs like the one you picture display characters. That is all they do. You can't address the pixels in the display.
And as a point of clarification, you are talking about the 5 pixel by 7 pixel character blocks on the display as if a character is a pixel. It's not. A character block consists of 5 x 7 pixels.
Some versions may have a pre-defined solid block character, as Majenko said in their answer. You could print as many of those solid blocks as you want.
You could also define a single custom character that displays a solid block and print as many of those as you want.
As a third option (again from Majenko's excellent answer) you could define 5 different custom characters, each with a different number of columns of pixels filled in. You could then write code that displayed solid blocks for all but the last character, and then one of the 5 partly filled custom characters, and get a finer resolution of simulated bar graph.
All that said, remember, the LCD display can only display 5x7 blocks with blank space between. The LCD is built without any pixels between the characters, so there will always be blank spaces.
There are other pixel displays you could use. (I've seen OLED displays where you can control every character individually.)