Delete thread
Last edited:
You will need to overwrite the unwanted blocks with spaces.But when I decrease the votlage, the custom character does not.
I kind of did that with this codeYou will need to overwrite the unwanted blocks with spaces.
void ASignal (float q) //analague signal.
{
float divider = 255;
int sum = q/divider;
cmdLCD(LCD_LINE2);
for(int i = 0; i<sum; i++)
if(i==sum)
{
putLCD(' ');
}
else putLCD(0xFF);
No you didn't.I kind of did that with this code
Ah i see.No you didn't.
The for loop will print the necessary number of blocks and then exit. Within that loop 'i' will never equal 'sum'.
After the for loop ends you need another for loop which runs from 'sum' to 16 and writes spaces.
That would be the simple way to do it.
You could make it more 'intelligent' by keeping track of the last number of blocks and then adding or deleting blocks as necessary but that's more difficult to write.
I doubt it's worth the effort. But this version shows how to get better resolution of the bar display.Ah i see.
Sorry if it's a hassle, but do you mind showing me an example of the more intelligent way? cheers.
Awesome! Thank youI doubt it's worth the effort. But this version shows how to get better resolution of the bar display.
https://www.electronicsblog.net/arduino-lcd-horizontal-progress-bar-using-custom-characters/
by Duane Benson
by Jake Hertz
by Jake Hertz
by Jake Hertz