I was just playing around with Ingvar's battery icon, and thought this was pretty neat.
It allows you to show the battery level with the same icon.
The demo just runs thru a loop counting backwards from 10, and changes the Custom Character accordingly.
It also demonstrates how you can animate the characters by simply updating the CGRAM.
Any characters that are already on the screen will automatically be updated as well.
DarrelCode:BattLevel var byte ' 0 - 10, 0=Empty 10=Full Char var byte y var byte LCDout $FE,1," ",1," ",1," ",1," ",1 ' Show 4 batteries Loop: ' Test loop showing all the possible Battery Levels for BattLevel = 10 to 0 step -1 gosub ShowBattery pause 500 next BattLevel goto Loop ShowBattery: ' Show Battery Level 0 - 10, 0=Empty 10=Full lcdout $FE,$48,$06 for y = 5 to 1 step -1 if BattLevel >= (y * 2 - 1) then if BattLevel >= (y * 2) then Char = $0F else Char = $0B endif else Char = $09 endif lcdout Char next y lcdout $0F,$00 return





Bookmarks