Author Topic: Large fort support for 4x20 LCD  (Read 6763 times)

xsherlock

  • Jr. Member
  • **
  • Posts: 78
    • View Profile
Large fort support for 4x20 LCD
« on: April 13, 2015, 14:05:51 »
I have an idea that you could bring large font support for the 4x20 LCD
Especialy it would be nice to have 3x3 large font like this one

http://hifiduino.blogspot.it/2009/05/improved-display.html

At least for numbers. So I can make nice readouts that can be read from afar.

I know that it can be done with 5" LCD but that requires designing UI as a webpage and is a lot of work for simple hacks.


Loetkolben

  • Hero Member
  • *****
  • Posts: 1.178
    • View Profile
Re: Large fort support for 4x20 LCD
« Reply #1 on: April 13, 2015, 19:32:01 »
Very nice idea. But for the Moment you can help yourself:

Just place some "■" at the desired Position. ;-)

Der Loetkolben

xsherlock

  • Jr. Member
  • **
  • Posts: 78
    • View Profile
Re: Large fort support for 4x20 LCD
« Reply #2 on: April 18, 2015, 00:21:38 »
I have two litte todlers that will wake up any moment and you really made me do late in night.... :)

Prints a 4 digit readout in a nice large font...

Code: [Select]
    lcd.set_custom_character(0,[31,31,31,31,31,31,31,31])
    lcd.set_custom_character(1,[31,31,31,31,31,0,0,0])
    lcd.set_custom_character(2,[0,0,0,31,31,31,31,31])
    lcd.set_custom_character(3,[0,0,0,0,0,0,0,0])
    lcd.set_custom_character(4,[31,31,31,31,31,31,0,0])
    lcd.set_custom_character(5,[0,31,31,31,31,31,0,0])
    lcd.set_custom_character(6,[0,31,31,31,31,31,31,31])

def print_large_digit(x,y,digit):
    if digit==0:
        lcd.write_line(x,y,chr(8))
        lcd.write_line(x,y+1,chr(9))
        lcd.write_line(x,y+2,chr(8))
        lcd.write_line(x+1,y,chr(8))
        lcd.write_line(x+1,y+1,chr(11))
        lcd.write_line(x+1,y+2,chr(8))
        lcd.write_line(x+2,y,chr(8))
        lcd.write_line(x+2,y+1,chr(10))
        lcd.write_line(x+2,y+2,chr(8))
    elif digit==1:
        lcd.write_line(x,y,chr(10))
        lcd.write_line(x,y+1,chr(8))
        lcd.write_line(x,y+2,chr(11))
        lcd.write_line(x+1,y,chr(11))
        lcd.write_line(x+1,y+1,chr(8))
        lcd.write_line(x+1,y+2,chr(11))
        lcd.write_line(x+2,y,chr(10))
        lcd.write_line(x+2,y+1,chr(8))
        lcd.write_line(x+2,y+2,chr(10))
    elif digit==2:
        lcd.write_line(x,y,chr(9))
        lcd.write_line(x,y+1,chr(9))
        lcd.write_line(x,y+2,chr(8))
        lcd.write_line(x+1,y,chr(14))
        lcd.write_line(x+1,y+1,chr(13))
        lcd.write_line(x+1,y+2,chr(12))
        lcd.write_line(x+2,y,chr(8))
        lcd.write_line(x+2,y+1,chr(10))
        lcd.write_line(x+2,y+2,chr(10))   
    elif digit==3:
        lcd.write_line(x,y,chr(9))
        lcd.write_line(x,y+1,chr(9))
        lcd.write_line(x,y+2,chr(8))
        lcd.write_line(x+1,y,chr(13))
        lcd.write_line(x+1,y+1,chr(13))
        lcd.write_line(x+1,y+2,chr(8))
        lcd.write_line(x+2,y,chr(10))
        lcd.write_line(x+2,y+1,chr(10))
        lcd.write_line(x+2,y+2,chr(8))
    elif digit==4:
        lcd.write_line(x,y,chr(8))
        lcd.write_line(x,y+1,chr(11))
        lcd.write_line(x,y+2,chr(8))
        lcd.write_line(x+1,y,chr(12))
        lcd.write_line(x+1,y+1,chr(13))
        lcd.write_line(x+1,y+2,chr(8))
        lcd.write_line(x+2,y,chr(11))
        lcd.write_line(x+2,y+1,chr(11))
        lcd.write_line(x+2,y+2,chr(8))
    elif digit==5:
        lcd.write_line(x,y,chr(8))
        lcd.write_line(x,y+1,chr(9))
        lcd.write_line(x,y+2,chr(9))
        lcd.write_line(x+1,y,chr(12))
        lcd.write_line(x+1,y+1,chr(13))
        lcd.write_line(x+1,y+2,chr(14))
        lcd.write_line(x+2,y,chr(10))
        lcd.write_line(x+2,y+1,chr(10))
        lcd.write_line(x+2,y+2,chr(8))   
    elif digit==6:
        lcd.write_line(x,y,chr(8))
        lcd.write_line(x,y+1,chr(9))
        lcd.write_line(x,y+2,chr(9))
        lcd.write_line(x+1,y,chr(8))
        lcd.write_line(x+1,y+1,chr(13))
        lcd.write_line(x+1,y+2,chr(14))
        lcd.write_line(x+2,y,chr(8))
        lcd.write_line(x+2,y+1,chr(10))
        lcd.write_line(x+2,y+2,chr(8))
    elif digit==7:
        lcd.write_line(x,y,chr(9))
        lcd.write_line(x,y+1,chr(9))
        lcd.write_line(x,y+2,chr(8))
        lcd.write_line(x+1,y,chr(11))
        lcd.write_line(x+1,y+1,chr(11))
        lcd.write_line(x+1,y+2,chr(8))
        lcd.write_line(x+2,y,chr(11))
        lcd.write_line(x+2,y+1,chr(11))
        lcd.write_line(x+2,y+2,chr(8))
    elif digit==8:
        lcd.write_line(x,y,chr(8))
        lcd.write_line(x,y+1,chr(9))
        lcd.write_line(x,y+2,chr(8))
        lcd.write_line(x+1,y,chr(8))
        lcd.write_line(x+1,y+1,chr(13))
        lcd.write_line(x+1,y+2,chr(8))
        lcd.write_line(x+2,y,chr(8))
        lcd.write_line(x+2,y+1,chr(10))
        lcd.write_line(x+2,y+2,chr(8))   
    elif digit==9:
        lcd.write_line(x,y,chr(8))
        lcd.write_line(x,y+1,chr(9))
        lcd.write_line(x,y+2,chr(8))
        lcd.write_line(x+1,y,chr(12))
        lcd.write_line(x+1,y+1,chr(13))
        lcd.write_line(x+1,y+2,chr(8))
        lcd.write_line(x+2,y,chr(10))
        lcd.write_line(x+2,y+1,chr(10))
        lcd.write_line(x+2,y+2,chr(8))
    elif digit==99:
        lcd.write_line(x,y,chr(11))
        lcd.write_line(x,y+1,chr(11))
        lcd.write_line(x,y+2,chr(11))
        lcd.write_line(x+1,y,chr(11))
        lcd.write_line(x+1,y+1,chr(11))
        lcd.write_line(x+1,y+2,chr(11))
        lcd.write_line(x+2,y,chr(11))
        lcd.write_line(x+2,y+1,chr(11))
        lcd.write_line(x+2,y+2,chr(11))

def print_large_4(x,y,number ):
   
    number_str = str(number)
    if number  < 1000:
        if number  < 100:
            print_large_digit(x,y,99)
            print_large_digit(x,y+4,99)
            digit_3 = int(number_str[0])           
            digit_4 = int(number_str[1])
           
        else:
            print_large_digit(x,y,99)
            digit_2 = int(number_str[0])
            digit_3 = int(number_str[1])           
            digit_4 = int(number_str[2])
            print_large_digit(x,y+4,digit_2)       
    else:
        digit_1 = int(number_str[0])
        digit_2 = int(number_str[1])
        digit_3 = int(number_str[2])           
        digit_4 = int(number_str[3])
        print_large_digit(x,y,digit_1)
        print_large_digit(x,y+4,digit_2)
     
    print_large_digit(x,y+8,digit_3)
    print_large_digit(x,y+12,digit_4)
« Last Edit: April 30, 2015, 15:42:32 by xsherlock »