Jump to content

Large fort support for 4x20 LCD


xsherlock

Recommended Posts

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.

 

 

Link to comment
Share on other sites

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...

 

    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()
        lcd.write_line(x,y+1,chr(9))
        lcd.write_line(x,y+2,chr()
        lcd.write_line(x+1,y,chr()
        lcd.write_line(x+1,y+1,chr(11))
        lcd.write_line(x+1,y+2,chr()
        lcd.write_line(x+2,y,chr()
        lcd.write_line(x+2,y+1,chr(10))
        lcd.write_line(x+2,y+2,chr()
    elif digit==1:
        lcd.write_line(x,y,chr(10))
        lcd.write_line(x,y+1,chr()
        lcd.write_line(x,y+2,chr(11))
        lcd.write_line(x+1,y,chr(11))
        lcd.write_line(x+1,y+1,chr()
        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()
        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()
        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()
        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()
        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()
        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()
    elif digit==4:
        lcd.write_line(x,y,chr()
        lcd.write_line(x,y+1,chr(11))
        lcd.write_line(x,y+2,chr()
        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()
        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()
    elif digit==5:
        lcd.write_line(x,y,chr()
        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()   
    elif digit==6:
        lcd.write_line(x,y,chr()
        lcd.write_line(x,y+1,chr(9))
        lcd.write_line(x,y+2,chr(9))
        lcd.write_line(x+1,y,chr()
        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()
        lcd.write_line(x+2,y+1,chr(10))
        lcd.write_line(x+2,y+2,chr()
    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()
        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()
        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()
    elif digit==8:
        lcd.write_line(x,y,chr()
        lcd.write_line(x,y+1,chr(9))
        lcd.write_line(x,y+2,chr()
        lcd.write_line(x+1,y,chr()
        lcd.write_line(x+1,y+1,chr(13))
        lcd.write_line(x+1,y+2,chr()
        lcd.write_line(x+2,y,chr()
        lcd.write_line(x+2,y+1,chr(10))
        lcd.write_line(x+2,y+2,chr()   
    elif digit==9:
        lcd.write_line(x,y,chr()
        lcd.write_line(x,y+1,chr(9))
        lcd.write_line(x,y+2,chr()
        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()
        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()
    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)

2015-04-18_00_23_23.thumb.jpg.9154158ea48f9112d0fcf555bc84b9ec.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...