epaper's waveshare lib

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
Post Reply
IHOXOHI
Posts: 112
Joined: Sat Apr 25, 2020 7:31 am

epaper's waveshare lib

Post by IHOXOHI » Sat Oct 24, 2020 8:57 am

Hi,
I tested differents formats of epaper by waveshare(2in7, 2in9,4in2 and 7in5). I use mcauser's lib. It's important to check version because waveshare has produce a lots of "new" version like v2 for example.
Check if there is one line DIN or 2 lines MOSI and MISO is very important too, to choice a good driver.

For me, 2in9 (DIN) and 4in2 (MOSI and MISO) formats works perfectly with mcauser's libs.
With the font_to_py.py and writer module by pythoncoder, the result is beautiful, but in this case, a bug appears after nearly 500 cycles of 60 sec with a pyb-d.

The 2in7 doesn't woks. The return is about a "LUT_BW" which is not indicated. I have changed this constant with others LUT_constantes, without success (no return, nothing happen, blocked prompt)... It seems that this epaper need an initiate like the 2.9 with a MASTER SPI state, but a framebuffer use like the 4.2 in micropython language without SPI MASTER state...

The 7in5 can works if I change in the lib the division of display_frame def (8 by 4) with a pyb-d,

Code: Select all

def display_frame(self, frame_buffer):
        self._command(DATA_START_TRANSMISSION_1)
        for i in range(0, self.width * self.height // 4):
but then it concern only half of the display. Maybe it could be a problem of computation's capacity (7in5 is very big). The return without change is about "bytearray index out of"...

I tried 2in13d and v2, 1in54v2 format without success. for moment...
Last edited by IHOXOHI on Sun Nov 08, 2020 9:12 am, edited 1 time in total.

IHOXOHI
Posts: 112
Joined: Sat Apr 25, 2020 7:31 am

Re: epaper's waveshare lib

Post by IHOXOHI » Tue Oct 27, 2020 4:32 pm

Yep,

I wrote something "quickly" just to troubleshoot displaying larger print during long time.
This is la lilttle bit long and just for numbers, m, v, and c letters.
Image
I don't succeed to put alls def of each number or letter in other file that we could import... If someone has an advise for doing that... maybe I can write something for alls letters and others differents sizes...

the code of alls def of numbers...:

Code: Select all

##each number has 9 pixels on xplan and 13 pixels on yplan
def space(a,b):
    pass
def lettre_m(a,b):
    fb.vline(1+a,1+b, 13, black)
    fb.vline(2+a,1+b, 13, black)
    fb.vline(3+a,2+b, 2, black)
    fb.vline(4+a,3+b, 2, black)
    fb.vline(5+a,4+b, 2, black)
    fb.vline(6+a,3+b, 2, black)
    fb.vline(7+a,2+b, 2, black)
    fb.vline(8+a,1+b, 13, black)
    fb.vline(9+a,1+b, 13, black)

def lettre_v(a,b):
    fb.vline(1+a,1+b, 4, black)
    fb.vline(2+a,1+b, 7, black)
    fb.vline(3+a,4+b, 7, black)
    fb.vline(4+a,7+b, 7, black)
    fb.vline(5+a,10+b, 4, black)
    fb.vline(6+a,7+b, 7, black)
    fb.vline(7+a,4+b, 7, black)
    fb.vline(8+a,1+b, 7, black)
    fb.vline(9+a,1+b, 4, black)

def lettre_c(a,b):
    fb.hline(5+a,1+b, 5, black)
    fb.hline(4+a,2+b, 6, black)
    fb.hline(3+a,3+b, 3, black)
    fb.hline(2+a,4+b, 3, black)
    fb.hline(2+a,5+b, 2, black)
    fb.vline(1+a,6+b, 3, black)
    fb.vline(2+a,6+b, 5, black)
    fb.vline(3+a,9+b, 3, black)
    fb.vline(4+a,10+b, 3, black)
    fb.vline(5+a,11+b, 3, black)
    fb.hline(6+a,12+b, 4, black)
    fb.hline(6+a,13+b, 4, black)

def pourcent(a,b):
    fb.vline(1+a,10+b, 3, black)
    fb.vline(2+a,9+b, 3, black)
    fb.vline(3+a,8+b, 3, black)
    fb.vline(4+a,7+b, 3, black)
    fb.vline(5+a,6+b, 3, black)
    fb.vline(6+a,5+b, 3, black)
    fb.vline(7+a,4+b, 3, black)
    fb.vline(8+a,3+b, 3, black)
    fb.vline(9+a,2+b, 3, black)
    fb.vline(3+a,3+b, 2, black)
    fb.vline(5+a,3+b, 2, black)
    fb.vline(2+a,2+b, 3, black)
    fb.vline(3+a,1+b, 5, black)
    fb.vline(4+a,1+b, 5, black)
    fb.vline(5+a,2+b, 3, black)
    fb.vline(6+a,9+b, 3, black)
    fb.vline(7+a,8+b, 5, black)
    fb.vline(8+a,8+b, 5, black)
    fb.vline(9+a,9+b, 3, black)

def slash(a,b): 
    fb.vline(1+a,10+b, 2, black)
    fb.vline(2+a,10+b, 2, black)
    fb.vline(2+a,8+b, 2, black)
    fb.vline(3+a,8+b, 2, black)
    fb.vline(3+a,6+b, 2, black)
    fb.vline(4+a,6+b, 2, black)
    fb.vline(4+a,4+b, 2, black)
    fb.vline(5+a,4+b, 2, black)
    fb.vline(5+a,2+b, 2, black)
    fb.vline(6+a,2+b, 2, black)
    
def point2(a,b):
    fb.hline(2+a,11+b, 2, black)
    fb.hline(2+a,10+b, 2, black)
    fb.hline(2+a,7+b, 2, black)
    fb.hline(2+a,6+b, 2, black)

def point(a,b):
    fb.hline(2+a,12+b, 2, black)
    fb.hline(2+a,13+b, 2, black)

def number_0(a,b):
    fb.vline(1+a,6+b, 3, black)
    fb.vline(2+a,3+b, 9, black)
    fb.vline(3+a,2+b, 4, black)
    fb.vline(3+a,9+b, 4, black)
    fb.vline(4+a,1+b, 3, black)
    fb.vline(4+a,11+b, 3, black)
    fb.vline(5+a,1+b, 2, black)
    fb.vline(5+a,12+b, 2, black)
    fb.vline(6+a,1+b, 3, black)
    fb.vline(6+a,11+b, 3, black)
    fb.vline(7+a,2+b, 4, black)
    fb.vline(7+a,9+b, 4, black)
    fb.vline(8+a,3+b, 9, black)
    fb.vline(9+a,6+b, 3, black)
    
def number_1(a,b):
    fb.vline(6+a,1+b, 13, black)
    fb.vline(7+a,1+b, 13, black)
    fb.vline(5+a,2+b, 2, black)
    fb.vline(4+a,3+b, 2, black)
    fb.vline(3+a,4+b, 2, black)
    fb.pixel(2,5)

def number_2(a,b):
    fb.hline(4+a,1+b, 3, black)
    fb.hline(3+a,2+b, 5, black)
    fb.hline(2+a,3+b, 2, black)
    fb.hline(7+a,3+b, 2, black)
    fb.hline(1+a,4+b, 2, black)
    fb.hline(8+a,4+b, 2, black)
    fb.hline(1+a,5+b, 2, black)
    fb.hline(8+a,5+b, 2, black)
    fb.hline(7+a,6+b, 2, black)
    fb.hline(6+a,7+b, 2, black)
    fb.hline(5+a,8+b, 2, black)
    fb.hline(4+a,9+b, 2, black)
    fb.hline(3+a,10+b, 2, black)
    fb.hline(2+a,11+b, 2, black)
    fb.hline(1+a,12+b, 9, black)
    fb.hline(1+a,13+b, 9, black)

def number_3(a,b):
    fb.hline(1+a,1+b, 7, black)
    fb.hline(1+a,2+b, 7, black)
    fb.vline(8+a,1+b, 13, black)
    fb.vline(9+a,1+b, 13, black)
    fb.hline(4+a,6+b, 4, black)
    fb.hline(3+a,7+b, 5, black)
    fb.hline(4+a,8+b, 4, black)
    fb.hline(1+a,12+b, 7, black)
    fb.hline(1+a,13+b, 7, black)

def number_4(a,b):
    fb.vline(2+a,8+b, 4, black)
    fb.vline(3+a,7+b, 5, black)
    fb.hline(4+a,10+b, 6, black)
    fb.hline(4+a,11+b, 6, black)
    fb.vline(7+a,8+b, 6, black)
    fb.vline(8+a,8+b, 6, black)
    fb.vline(4+a,6+b, 2, black)
    fb.vline(5+a,5+b, 2, black)
    fb.vline(6+a,4+b, 2, black)
    fb.vline(7+a,3+b, 2, black)
    fb.vline(8+a,2+b, 2, black)
    fb.vline(9+a,1+b, 2, black)

def number_5(a,b):
    fb.hline(1+a,1+b, 9, black)
    fb.hline(1+a,2+b, 9, black)
    fb.vline(1+a,3+b, 5, black)
    fb.vline(2+a,3+b, 5, black)
    fb.hline(3+a,6+b, 4, black)
    fb.hline(3+a,7+b, 6, black)
    fb.hline(6+a,8+b, 4, black)
    fb.hline(8+a,9+b, 2, black)
    fb.hline(8+a,10+b, 2, black)
    fb.hline(6+a,11+b, 4, black)
    fb.hline(1+a,12+b, 8, black)
    fb.hline(1+a,13+b, 6, black)

def number_6(a,b):
    fb.hline(4+a,1+b, 6, black)
    fb.hline(3+a,2+b, 7, black)
    fb.vline(3+a,3+b, 2, black)
    fb.vline(2+a,3+b, 9, black)
    fb.vline(1+a,5+b, 6, black)
    fb.vline(3+a,7+b, 6, black)
    fb.hline(4+a,6+b, 3, black)
    fb.hline(4+a,7+b, 5, black)
    fb.vline(4+a,11+b, 3, black)
    fb.hline(5+a,13+b, 2, black)
    fb.hline(5+a,12+b, 3, black)
    fb.hline(6+a,11+b, 3, black)
    fb.hline(7+a,8+b, 3, black)
    fb.hline(8+a,9+b, 2, black)
    fb.hline(8+a,10+b, 2, black)

def number_7(a,b):
    fb.hline(1+a,1+b, 6, black)
    fb.hline(1+a,2+b, 6, black)
    fb.vline(5+a,3+b, 11, black)
    fb.vline(6+a,3+b, 11, black)
    fb.hline(3+a,6+b, 6, black)
    fb.hline(3+a,7+b, 6, black)

def number_8(a,b):
    fb.hline(4+a,1+b, 3, black)
    fb.hline(3+a,2+b, 5, black)
    fb.hline(2+a,3+b, 2, black)
    fb.hline(7+a,3+b, 2, black)
    fb.hline(1+a,4+b, 2, black)
    fb.hline(8+a,4+b, 2, black)
    fb.hline(2+a,5+b, 2, black)
    fb.hline(7+a,5+b, 2, black)
    fb.hline(3+a,6+b, 5, black)
    fb.hline(4+a,7+b, 3, black)
    fb.hline(3+a,8+b, 5, black)
    fb.hline(2+a,9+b, 2, black)
    fb.hline(7+a,9+b, 2, black)
    fb.hline(1+a,10+b, 2, black)
    fb.hline(8+a,10+b, 2, black)
    fb.hline(2+a,11+b, 2, black)
    fb.hline(7+a,11+b, 2, black)
    fb.hline(3+a,12+b, 5, black)
    fb.hline(4+a,13+b, 3, black)

def number_9(a,b):
    fb.hline(2+a,13+b, 5, black)
    fb.hline(2+a,12+b, 6, black)
    fb.hline(7+a,11+b, 3, black)
    fb.vline(9+a,4+b, 8, black)
    fb.vline(8+a,3+b, 9, black)
    fb.hline(4+a,7+b, 3, black)
    fb.hline(2+a,6+b, 6, black)
    fb.hline(1+a,5+b, 3, black)
    fb.hline(6+a,5+b, 2, black)
    fb.hline(1+a,4+b, 2, black)
    fb.pixel(7+a,4+b)
    fb.hline(1+a,3+b, 3, black)
    fb.hline(7+a,3+b, 2, black)
    fb.hline(2+a,2+b, 6, black)
    fb.hline(4+a,1+b, 3, black)
The code to use it in a main file:

Code: Select all

def conversion(number, a, b):
    number = str(number)
    a = str(a)
    b = str(b)
    liste_noms_symbols = ["number_0", "number_1", "number_2", "number_3", "number_4", "number_5", "number_6", "number_7", "number_8", "number_9", "point", "point2", "slash", "pourcent", "lettre_m", "lettre_c", "lettre_v", "space"]
    liste_symbols = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", ":", "/", "%", "M", "C", "V", " "]
    for i in liste_symbols:
        if i == number:
            phrasi = liste_noms_symbols[liste_symbols.index(i)] + "(" + a + "," + b + ")"    
    convert = eval(phrasi)
    return convert

def affichage(numbers,a,b=0):
    numbers = str(numbers)
    for i in numbers:
        i = str(i)
        if i == ":" or i == ".":
            conversion(i,a,b)
        if i == "/":
            conversion(i,a,b)
            a += 8
        else:
            conversion(i,a,b)
            a += 12
while 1:
    fb.fill(white)
    affichage("{}/{}".format(jour,mois),62,10)
    affichage("{}:{}".format(heure,minu),240,10)

    affichage("{}C".format(temp),150,70)
    affichage("{}%".format(hum),150,110)
    affichage(luxi,150,150)

    affichage("C02:{}".format(co2),150,190)
    affichage("V0C:{}".format(voc),150,230)

    affichage(count,150,260)

    e.display_frame(buf)

    time.sleep(60)
Image

For sure, it will be better to change directly something in the buffer behaviour to increase correctly the size of displaying symbols.
But, how do that?

Thanks.
Attachments
DSC_1491-comp.JPG
DSC_1491-comp.JPG (64.8 KiB) Viewed 734 times
DSC_1492-comp.JPG
DSC_1492-comp.JPG (45.57 KiB) Viewed 734 times

IHOXOHI
Posts: 112
Joined: Sat Apr 25, 2020 7:31 am

Re: epaper's waveshare lib

Post by IHOXOHI » Thu Oct 29, 2020 10:00 pm

Yup,

The code (859 lignes) for alls letters, numbers with . : / % + - = _ ! ? symbols:

Code: Select all

##each number has 9 pixels on xplan and 13 pixels on yplan
def space(a,b):
    pass

def lettre_A(a,b):
    fb.vline(4+a,1+b, 6, black)
    fb.vline(5+a,1+b, 3, black)
    fb.vline(6+a,1+b, 6, black)
    fb.vline(3+a,4+b, 7, black)
    fb.vline(2+a,7+b, 7, black)
    fb.vline(1+a,11+b, 3, black)
    fb.vline(7+a,4+b, 7, black)
    fb.vline(8+a,7+b, 7, black)
    fb.vline(9+a,11+b, 3, black)
    fb.hline(4+a,9+b, 3, black)
    fb.hline(4+a,10+b, 3, black)

def lettre_B(a,b):
    fb.vline(1+a,1+b, 13, black)
    fb.vline(2+a,1+b, 13, black)
    fb.hline(3+a,1+b, 3, black)
    fb.hline(3+a,2+b, 6, black)
    fb.hline(6+a,3+b, 4, black)
    fb.hline(8+a,4+b, 2, black)
    fb.hline(6+a,5+b, 4, black)
    fb.hline(3+a,6+b, 6, black)
    fb.hline(3+a,7+b, 4, black)
    fb.hline(5+a,8+b, 4, black)
    fb.hline(6+a,9+b, 4, black)
    fb.hline(8+a,10+b, 2, black)
    fb.hline(6+a,11+b, 4, black)
    fb.hline(3+a,12+b, 6, black)
    fb.hline(3+a,13+b, 4, black) 

def lettre_C(a,b):
    fb.hline(5+a,1+b, 5, black)
    fb.hline(4+a,2+b, 6, black)
    fb.hline(3+a,3+b, 3, black)
    fb.hline(2+a,4+b, 3, black)
    fb.hline(2+a,5+b, 2, black)
    fb.vline(1+a,6+b, 3, black)
    fb.vline(2+a,6+b, 5, black)
    fb.vline(3+a,9+b, 3, black)
    fb.vline(4+a,10+b, 3, black)
    fb.vline(5+a,11+b, 3, black)
    fb.hline(6+a,12+b, 4, black)
    fb.hline(6+a,13+b, 4, black)

def lettre_D(a,b):
    fb.vline(1+a,1+b, 13, black)
    fb.vline(2+a,1+b, 13, black)
    fb.hline(3+a,1+b, 2, black)
    fb.hline(3+a,2+b, 4, black)
    fb.hline(3+a,3+b, 5, black)
    fb.hline(6+a,4+b, 2, black)
    fb.hline(7+a,5+b, 3, black)
    fb.vline(8+a,6+b, 5, black)
    fb.vline(9+a,6+b, 4, black)
    fb.vline(7+a,9+b, 3, black)
    fb.pixel(6+a,10+b, black)
    fb.hline(3+a,11+b, 4, black)
    fb.hline(3+a,12+b, 4, black)
    fb.hline(3+a,13+b, 2, black)

def lettre_E(a,b):
    fb.vline(1+a,1+b, 13, black)
    fb.vline(2+a,1+b, 13, black)
    fb.hline(3+a,1+b, 7, black)
    fb.hline(3+a,2+b, 7, black)
    fb.hline(3+a,6+b, 5, black)
    fb.hline(3+a,7+b, 5, black)
    fb.hline(3+a,12+b, 7, black)
    fb.hline(3+a,13+b, 7, black)

def lettre_F(a,b):
    fb.vline(1+a,1+b, 13, black)
    fb.vline(2+a,1+b, 13, black)
    fb.hline(3+a,1+b, 7, black)
    fb.hline(3+a,2+b, 7, black)
    fb.hline(3+a,6+b, 5, black)
    fb.hline(3+a,7+b, 5, black)

def lettre_G(a,b):
    fb.hline(4+a,1+b, 5, black)
    fb.hline(3+a,2+b, 6, black)
    fb.vline(3+a,3+b, 2, black)
    fb.vline(2+a,3+b, 9, black)
    fb.vline(1+a,5+b, 6, black)
    fb.vline(3+a,10+b, 3, black)
    fb.hline(6+a,8+b, 4, black)
    fb.hline(6+a,9+b, 4, black)
    fb.hline(8+a,10+b, 2, black)
    fb.hline(4+a,13+b, 3, black)
    fb.hline(6+a,11+b, 3, black)
    fb.hline(4+a,12+b, 4, black)
    
def lettre_H(a,b):
    fb.vline(1+a,1+b, 13, black)
    fb.vline(2+a,1+b, 13, black)
    fb.vline(8+a,1+b, 13, black)
    fb.vline(9+a,1+b, 13, black)
    fb.hline(3+a,6+b, 5, black)
    fb.hline(3+a,7+b, 5, black)

def lettre_I(a,b):
    fb.vline(5+a,3+b, 10, black)
    fb.vline(6+a,3+b, 10, black)
    fb.vline(4+a,3+b, 10, black)
    fb.hline(2+a,1+b, 7, black)
    fb.hline(2+a,2+b, 7, black)
    fb.hline(2+a,13+b, 7, black)
    fb.hline(2+a,12+b, 7, black)

def lettre_J(a,b):
    fb.hline(3+a,1+b, 7, black)
    fb.hline(3+a,2+b, 7, black)
    fb.vline(6+a,3+b, 9, black)
    fb.vline(7+a,3+b, 8, black)
    fb.vline(5+a,10+b, 3, black)
    fb.vline(4+a,11+b, 3, black)
    fb.vline(3+a,11+b, 3, black)
    fb.vline(2+a,9+b, 4, black)
    fb.vline(1+a,9+b, 3, black)

def lettre_K(a,b):
    fb.vline(1+a,1+b, 13, black)
    fb.vline(2+a,1+b, 13, black)
    fb.vline(3+a,6+b, 3, black)
    fb.vline(4+a,5+b, 5, black)
    fb.vline(5+a,4+b, 3, black)
    fb.vline(6+a,3+b, 3, black)
    fb.vline(7+a,2+b, 3, black)
    fb.vline(8+a,1+b, 3, black)
    fb.vline(9+a,1+b, 2, black)
    fb.vline(5+a,8+b, 3, black)
    fb.vline(6+a,9+b, 3, black)
    fb.vline(7+a,10+b, 3, black)
    fb.vline(8+a,11+b, 3, black)
    fb.vline(9+a,12+b, 2, black)

def lettre_L(a,b):
    fb.vline(1+a,1+b, 13, black)
    fb.vline(2+a,1+b, 13, black)
    fb.hline(3+a,12+b, 6, black)
    fb.hline(3+a,13+b, 6, black)

def lettre_M(a,b):
    fb.vline(1+a,1+b, 13, black)
    fb.vline(2+a,1+b, 13, black)
    fb.vline(3+a,2+b, 2, black)
    fb.vline(4+a,3+b, 3, black)
    fb.vline(5+a,4+b, 3, black)
    fb.vline(6+a,3+b, 3, black)
    fb.vline(7+a,2+b, 2, black)
    fb.vline(8+a,1+b, 13, black)
    fb.vline(9+a,1+b, 13, black)

def lettre_N(a,b):
    fb.vline(1+a,1+b, 13, black)
    fb.vline(2+a,1+b, 13, black)
    fb.vline(8+a,1+b, 13, black)
    fb.vline(9+a,1+b, 13, black)
    fb.vline(3+a,1+b, 5, black)
    fb.vline(4+a,2+b, 5, black)
    fb.vline(5+a,5+b, 5, black)
    fb.vline(6+a,7+b, 5, black)
    fb.vline(7+a,9+b, 5, black)

def lettre_P(a,b):
    fb.vline(1+a,1+b, 13, black)
    fb.vline(2+a,1+b, 13, black)
    fb.hline(3+a,1+b, 3, black)
    fb.hline(3+a,2+b, 6, black)
    fb.hline(6+a,3+b, 4, black)
    fb.hline(8+a,4+b, 2, black)
    fb.hline(6+a,5+b, 4, black)
    fb.hline(3+a,6+b, 6, black)
    fb.hline(3+a,7+b, 3, black) 
    
def lettre_Q(a,b):
    fb.vline(1+a,6+b, 3, black)
    fb.vline(2+a,3+b, 9, black)
    fb.vline(3+a,2+b, 4, black)
    fb.vline(3+a,9+b, 4, black)
    fb.vline(4+a,1+b, 3, black)
    fb.vline(4+a,11+b, 3, black)
    fb.vline(5+a,1+b, 2, black)
    fb.vline(5+a,12+b, 2, black)
    fb.vline(6+a,1+b, 3, black)
    fb.vline(6+a,11+b, 3, black)
    fb.vline(7+a,2+b, 4, black)
    fb.vline(7+a,9+b, 4, black)
    fb.vline(8+a,3+b, 9, black)
    fb.vline(9+a,6+b, 3, black)
    fb.vline(5+a,9+b, 2, black)
    fb.vline(6+a,9+b, 2, black)
    fb.vline(8+a,12+b, 2, black)

def lettre_R(a,b):
    fb.vline(1+a,1+b, 13, black)
    fb.vline(2+a,1+b, 13, black)
    fb.hline(3+a,1+b, 3, black)
    fb.hline(3+a,2+b, 6, black)
    fb.hline(6+a,3+b, 4, black)
    fb.hline(8+a,4+b, 2, black)
    fb.hline(6+a,5+b, 4, black)
    fb.hline(3+a,6+b, 6, black)
    fb.hline(3+a,7+b, 3, black)
    fb.hline(5+a,8+b, 2, black)
    fb.hline(6+a,9+b, 2, black)
    fb.hline(7+a,10+b, 2, black)
    fb.hline(8+a,11+b, 2, black)
    fb.hline(8+a,12+b, 2, black)
    fb.hline(8+a,13+b, 2, black)

def lettre_S(a,b):
    fb.hline(4+a,1+b, 3, black)
    fb.hline(3+a,2+b, 5, black)
    fb.hline(2+a,3+b, 2, black)
    fb.hline(7+a,3+b, 2, black)
    fb.hline(1+a,4+b, 2, black)
    fb.hline(8+a,4+b, 2, black)
    fb.hline(2+a,5+b, 2, black)
    fb.hline(3+a,6+b, 3, black)
    fb.hline(4+a,7+b, 3, black)
    fb.hline(5+a,8+b, 3, black)
    fb.hline(7+a,9+b, 2, black)
    fb.hline(1+a,10+b, 2, black)
    fb.hline(8+a,10+b, 2, black)
    fb.hline(2+a,11+b, 2, black)
    fb.hline(7+a,11+b, 2, black)
    fb.hline(3+a,12+b, 5, black)
    fb.hline(4+a,13+b, 3, black)

def lettre_T(a,b):
    fb.hline(1+a,1+b, 9, black)
    fb.hline(1+a,2+b, 9, black)
    fb.vline(4+a,3+b, 11, black)
    fb.vline(5+a,3+b, 11, black)
    fb.vline(6+a,3+b, 11, black)

def lettre_U(a,b):
    fb.vline(1+a,1+b, 10, black)
    fb.vline(2+a,1+b, 11, black)
    fb.vline(8+a,1+b, 11, black)
    fb.vline(9+a,1+b, 10, black)
    fb.vline(3+a,10+b, 3, black)
    fb.vline(4+a,11+b, 3, black)
    fb.vline(5+a,12+b, 2, black)
    fb.vline(6+a,11+b, 3, black)
    fb.vline(7+a,10+b, 3, black)

def lettre_V(a,b):
    fb.vline(1+a,1+b, 4, black)
    fb.vline(2+a,1+b, 7, black)
    fb.vline(3+a,4+b, 7, black)
    fb.vline(4+a,7+b, 7, black)
    fb.vline(5+a,10+b, 4, black)
    fb.vline(6+a,7+b, 7, black)
    fb.vline(7+a,4+b, 7, black)
    fb.vline(8+a,1+b, 7, black)
    fb.vline(9+a,1+b, 4, black)

def lettre_W(a,b):
    fb.vline(1+a,1+b, 5, black)
    fb.vline(2+a,1+b, 9, black)
    fb.vline(3+a,5+b, 9, black)
    fb.vline(4+a,9+b, 5, black)
    fb.vline(5+a,5+b, 5, black)
    fb.vline(6+a,9+b, 5, black)
    fb.vline(7+a,5+b, 9, black)
    fb.vline(8+a,1+b, 9, black)
    fb.vline(9+a,1+b, 5, black)

def lettre_X(a,b):
    fb.vline(1+a,1+b, 2, black)
    fb.vline(2+a,1+b, 4, black)
    fb.vline(3+a,2+b, 5, black)
    fb.vline(4+a,4+b, 7, black)
    fb.vline(5+a,6+b, 3, black)
    fb.vline(6+a,4+b, 7, black)
    fb.vline(7+a,2+b, 5, black)
    fb.vline(8+a,1+b, 4, black)
    fb.vline(9+a,1+b, 2, black)
    fb.vline(3+a,8+b, 5, black)
    fb.vline(2+a,10+b, 4, black)
    fb.vline(1+a,12+b, 2, black)
    fb.vline(7+a,8+b, 5, black)
    fb.vline(8+a,10+b, 4, black)
    fb.vline(9+a,12+b, 2, black)

def lettre_Y(a,b):
    fb.vline(1+a,1+b, 2, black)
    fb.vline(2+a,1+b, 4, black)
    fb.vline(3+a,2+b, 5, black)
    fb.vline(4+a,4+b, 7, black)
    fb.vline(5+a,6+b, 3, black)
    fb.vline(6+a,4+b, 4, black)
    fb.vline(7+a,2+b, 5, black)
    fb.vline(8+a,1+b, 4, black)
    fb.vline(9+a,1+b, 2, black)
    fb.vline(3+a,8+b, 5, black)
    fb.vline(2+a,10+b, 4, black)
    fb.vline(1+a,12+b, 2, black)

def lettre_Z(a,b):
    fb.hline(1+a,1+b, 9, black)
    fb.hline(1+a,2+b, 9, black)
    fb.hline(7+a,3+b, 3, black)
    fb.hline(6+a,4+b, 3, black)
    fb.vline(6+a,5+b, 3, black)
    fb.vline(7+a,5+b, 2, black)
    fb.hline(6+a,4+b, 3, black)
    fb.pixel(5+a,6+b, black)
    fb.hline(4+a,7+b, 3, black)
    fb.hline(3+a,8+b, 3, black)
    fb.vline(4+a,9+b, 2, black)
    fb.vline(3+a,9+b, 3, black)
    fb.vline(2+a,10+b, 2, black)
    fb.pixel(1+a,11+b, black)
    fb.hline(1+a,12+b, 9, black)
    fb.hline(1+a,13+b, 9, black)

def pourcent(a,b):
    fb.vline(1+a,10+b, 3, black)
    fb.vline(2+a,9+b, 3, black)
    fb.vline(3+a,8+b, 3, black)
    fb.vline(4+a,7+b, 3, black)
    fb.vline(5+a,6+b, 3, black)
    fb.vline(6+a,5+b, 3, black)
    fb.vline(7+a,4+b, 3, black)
    fb.vline(8+a,3+b, 3, black)
    fb.vline(9+a,2+b, 3, black)
    fb.vline(3+a,3+b, 2, black)
    fb.vline(5+a,3+b, 2, black)
    fb.vline(2+a,2+b, 3, black)
    fb.vline(3+a,1+b, 5, black)
    fb.vline(4+a,1+b, 5, black)
    fb.vline(5+a,2+b, 3, black)
    fb.vline(6+a,9+b, 3, black)
    fb.vline(7+a,8+b, 5, black)
    fb.vline(8+a,8+b, 5, black)
    fb.vline(9+a,9+b, 3, black)

def slash(a,b): 
    fb.vline(1+a,10+b, 2, black)
    fb.vline(2+a,10+b, 2, black)
    fb.vline(2+a,8+b, 2, black)
    fb.vline(3+a,8+b, 2, black)
    fb.vline(3+a,6+b, 2, black)
    fb.vline(4+a,6+b, 2, black)
    fb.vline(4+a,4+b, 2, black)
    fb.vline(5+a,4+b, 2, black)
    fb.vline(5+a,2+b, 2, black)
    fb.vline(6+a,2+b, 2, black)
    
def point2(a,b):
    fb.hline(4+a,10+b, 2, black)
    fb.hline(4+a,9+b, 2, black)
    fb.hline(4+a,7+b, 2, black)
    fb.hline(4+a,6+b, 2, black)

def point(a,b):
    fb.hline(4+a,12+b, 2, black)
    fb.hline(4+a,13+b, 2, black)

def plus(a,b):
    fb.hline(1+a,6+b, 9, black)
    fb.hline(1+a,7+b, 9, black)
    fb.hline(1+a,8+b, 9, black)
    fb.vline(4+a,3+b, 9, black)
    fb.vline(5+a,3+b, 9, black)
    fb.vline(6+a,3+b, 9, black)

def moins(a,b):
    fb.hline(2+a,6+b, 7, black)
    fb.hline(2+a,7+b, 7, black)
    fb.hline(2+a,8+b, 7, black)

def egal(a,b):
    fb.hline(2+a,5+b, 7, black)
    fb.hline(2+a,6+b, 7, black)
    fb.hline(2+a,8+b, 7, black)
    fb.hline(2+a,9+b, 7, black)

def underscore(a,b):
    fb.hline(1+a,12+b, 9, black)
    fb.hline(1+a,13+b, 9, black)

def interrogation(a,b): 
    fb.vline(2+a,2+b, 3, black)
    fb.vline(3+a,1+b, 4, black)
    fb.vline(4+a,1+b, 2, black)
    fb.vline(5+a,1+b, 2, black)
    fb.vline(6+a,2+b, 5, black)
    fb.vline(7+a,3+b, 3, black)
    fb.vline(5+a,6+b, 5, black)
    fb.vline(4+a,7+b, 4, black)
    fb.vline(4+a,12+b, 2, black)
    fb.vline(5+a,12+b, 2, black)

def exclamation(a,b): 
    fb.vline(4+a,1+b, 10, black)
    fb.vline(5+a,1+b, 10, black)
    fb.vline(4+a,12+b, 2, black)
    fb.vline(5+a,12+b, 2, black)

def number_0(a,b):
    fb.vline(1+a,6+b, 3, black)
    fb.vline(2+a,3+b, 9, black)
    fb.vline(3+a,2+b, 4, black)
    fb.vline(3+a,9+b, 4, black)
    fb.vline(4+a,1+b, 3, black)
    fb.vline(4+a,11+b, 3, black)
    fb.vline(5+a,1+b, 2, black)
    fb.vline(5+a,12+b, 2, black)
    fb.vline(6+a,1+b, 3, black)
    fb.vline(6+a,11+b, 3, black)
    fb.vline(7+a,2+b, 4, black)
    fb.vline(7+a,9+b, 4, black)
    fb.vline(8+a,3+b, 9, black)
    fb.vline(9+a,6+b, 3, black)
    
def number_1(a,b):
    fb.vline(6+a,1+b, 13, black)
    fb.vline(7+a,1+b, 13, black)
    fb.vline(5+a,2+b, 2, black)
    fb.vline(4+a,3+b, 2, black)
    fb.vline(3+a,4+b, 2, black)
    fb.pixel(2+a,5+b, black)

def number_2(a,b):
    fb.hline(4+a,1+b, 3, black)
    fb.hline(3+a,2+b, 5, black)
    fb.hline(2+a,3+b, 2, black)
    fb.hline(7+a,3+b, 2, black)
    fb.hline(1+a,4+b, 2, black)
    fb.hline(8+a,4+b, 2, black)
    fb.hline(1+a,5+b, 2, black)
    fb.hline(8+a,5+b, 2, black)
    fb.hline(7+a,6+b, 2, black)
    fb.hline(6+a,7+b, 2, black)
    fb.hline(5+a,8+b, 2, black)
    fb.hline(4+a,9+b, 2, black)
    fb.hline(3+a,10+b, 2, black)
    fb.hline(2+a,11+b, 2, black)
    fb.hline(1+a,12+b, 9, black)
    fb.hline(1+a,13+b, 9, black)

def number_3(a,b):
    fb.hline(1+a,1+b, 7, black)
    fb.hline(1+a,2+b, 8, black)
    fb.pixel(7+a,3+b, black)
    fb.vline(8+a,2+b, 10, black)
    fb.vline(9+a,3+b, 9, black)
    fb.hline(4+a,6+b, 4, black)
    fb.hline(4+a,7+b, 4, black)
    fb.hline(1+a,12+b, 8, black)
    fb.hline(1+a,13+b, 7, black)
    fb.pixel(7+a,11+b, black)

def number_4(a,b):
    fb.vline(2+a,8+b, 4, black)
    fb.vline(3+a,7+b, 5, black)
    fb.hline(4+a,10+b, 6, black)
    fb.hline(4+a,11+b, 6, black)
    fb.vline(7+a,1+b, 13, black)
    fb.vline(8+a,1+b, 13, black)
    fb.vline(4+a,6+b, 2, black)
    fb.vline(5+a,4+b, 3, black)
    fb.vline(6+a,2+b, 3, black)
    fb.vline(1+a,10+b, 2, black)

def number_5(a,b):
    fb.hline(1+a,1+b, 9, black)
    fb.hline(1+a,2+b, 9, black)
    fb.vline(1+a,3+b, 5, black)
    fb.vline(2+a,3+b, 5, black)
    fb.hline(3+a,6+b, 4, black)
    fb.hline(3+a,7+b, 6, black)
    fb.hline(7+a,8+b, 3, black)
    fb.hline(8+a,9+b, 2, black)
    fb.hline(8+a,10+b, 2, black)
    fb.hline(8+a,11+b, 2, black)
    fb.hline(1+a,12+b, 8, black)
    fb.hline(1+a,13+b, 7, black)

def number_6(a,b):
    fb.hline(4+a,1+b, 5, black)
    fb.hline(3+a,2+b, 6, black)
    fb.vline(3+a,3+b, 2, black)
    fb.vline(2+a,3+b, 9, black)
    fb.vline(1+a,5+b, 6, black)
    fb.vline(3+a,7+b, 6, black)
    fb.hline(4+a,6+b, 3, black)
    fb.hline(4+a,7+b, 5, black)
    fb.vline(4+a,11+b, 3, black)
    fb.hline(5+a,13+b, 2, black)
    fb.hline(5+a,12+b, 3, black)
    fb.hline(6+a,11+b, 3, black)
    fb.hline(7+a,8+b, 3, black)
    fb.hline(8+a,9+b, 2, black)
    fb.hline(8+a,10+b, 2, black)

def number_7(a,b):
    fb.hline(1+a,1+b, 9, black)
    fb.hline(1+a,2+b, 9, black)
    fb.vline(5+a,8+b, 6, black)
    fb.vline(6+a,8+b, 6, black)
    fb.hline(4+a,6+b, 5, black)
    fb.hline(4+a,7+b, 5, black)
    fb.hline(6+a,5+b, 2, black)
    fb.hline(6+a,4+b, 2, black)
    fb.hline(7+a,3+b, 2, black)

def number_8(a,b):
    fb.hline(4+a,1+b, 3, black)
    fb.hline(3+a,2+b, 5, black)
    fb.hline(2+a,3+b, 2, black)
    fb.hline(7+a,3+b, 2, black)
    fb.hline(1+a,4+b, 2, black)
    fb.hline(8+a,4+b, 2, black)
    fb.hline(2+a,5+b, 2, black)
    fb.hline(7+a,5+b, 2, black)
    fb.hline(3+a,6+b, 5, black)
    fb.hline(4+a,7+b, 3, black)
    fb.hline(3+a,8+b, 5, black)
    fb.hline(2+a,9+b, 2, black)
    fb.hline(7+a,9+b, 2, black)
    fb.hline(1+a,10+b, 2, black)
    fb.hline(8+a,10+b, 2, black)
    fb.hline(2+a,11+b, 2, black)
    fb.hline(7+a,11+b, 2, black)
    fb.hline(3+a,12+b, 5, black)
    fb.hline(4+a,13+b, 3, black)

def number_9(a,b):
    fb.hline(2+a,13+b, 5, black)
    fb.hline(2+a,12+b, 6, black)
    fb.hline(7+a,11+b, 3, black)
    fb.vline(9+a,4+b, 8, black)
    fb.vline(8+a,3+b, 9, black)
    fb.hline(4+a,7+b, 3, black)
    fb.hline(2+a,6+b, 6, black)
    fb.hline(1+a,5+b, 3, black)
    fb.hline(6+a,5+b, 2, black)
    fb.hline(1+a,4+b, 2, black)
    fb.pixel(7+a,4+b)
    fb.hline(1+a,3+b, 3, black)
    fb.hline(7+a,3+b, 2, black)
    fb.hline(2+a,2+b, 6, black)
    fb.hline(4+a,1+b, 3, black)

def lettre_a(a,b):
    fb.hline(4+a,5+b, 3, black)
    fb.hline(3+a,6+b, 5, black)
    fb.vline(3+a,7+b, 3, black)
    fb.vline(2+a,7+b, 3, black)
    fb.vline(7+a,7+b, 3, black)
    fb.vline(8+a,6+b, 6, black)
    fb.vline(6+a,9+b, 3, black)
    fb.vline(4+a,9+b, 3, black)
    fb.vline(5+a,10+b, 2, black)

def lettre_b(a,b):
    fb.vline(2+a,1+b, 11, black)
    fb.vline(3+a,1+b, 11, black)
    fb.hline(4+a,5+b, 2, black)
    fb.hline(4+a,6+b, 4, black)
    fb.hline(6+a,7+b, 3, black)
    fb.vline(7+a,8+b, 3, black)
    fb.vline(8+a,8+b, 2, black)
    fb.vline(6+a,9+b, 3, black)
    fb.hline(4+a,10+b, 2, black)
    fb.hline(4+a,11+b, 2, black)

def lettre_c(a,b):
    fb.vline(2+a,5+b, 5, black)
    fb.vline(3+a,4+b, 7, black)
    fb.vline(4+a,3+b, 3, black)
    fb.hline(5+a,3+b, 2, black)
    fb.hline(5+a,4+b, 4, black)
    fb.hline(6+a,5+b, 3, black)
    fb.hline(7+a,6+b, 2, black)
    fb.vline(4+a,9+b, 3, black)
    fb.hline(5+a,11+b, 2, black)
    fb.hline(5+a,10+b, 4, black)
    fb.hline(6+a,9+b, 3, black)
    fb.hline(7+a,8+b, 2, black)

def lettre_d(a,b):
    fb.vline(7+a,1+b, 11, black)
    fb.vline(8+a,1+b, 11, black)
    fb.hline(5+a,5+b, 3, black)
    fb.hline(3+a,6+b, 4, black)
    fb.hline(2+a,7+b, 3, black)
    fb.hline(2+a,8+b, 2, black)
    fb.hline(2+a,9+b, 3, black)
    fb.hline(3+a,10+b, 4, black)
    fb.hline(4+a,11+b, 3, black)

def lettre_e(a,b):
    fb.vline(2+a,6+b, 4, black)
    fb.vline(3+a,5+b, 6, black)
    fb.hline(4+a,4+b, 4, black)
    fb.hline(4+a,5+b, 5, black)
    fb.hline(7+a,6+b, 2, black)
    fb.hline(4+a,7+b, 5, black)
    fb.hline(4+a,8+b, 5, black)
    fb.vline(4+a,9+b, 3, black)
    fb.hline(5+a,10+b, 4, black)
    fb.hline(5+a,11+b, 4, black)

def lettre_f(a,b):
    fb.vline(2+a,3+b, 9, black)
    fb.vline(3+a,2+b, 10, black)
    fb.hline(4+a,1+b, 4, black)
    fb.hline(4+a,2+b, 4, black)
    fb.hline(4+a,5+b, 2, black)
    fb.vline(4+a,6+b, 2, black)

def lettre_g(a,b):
    fb.vline(2+a,6+b, 4, black)
    fb.vline(3+a,6+b, 5, black)
    fb.vline(7+a,6+b, 7, black)
    fb.vline(8+a,7+b, 5, black)
    fb.hline(4+a,5+b, 3, black)
    fb.hline(4+a,6+b, 3, black)
    fb.hline(4+a,9+b, 3, black)
    fb.hline(4+a,10+b, 2, black)
    fb.vline(6+a,11+b, 3, black)
    fb.hline(3+a,12+b, 3, black)
    fb.hline(3+a,13+b, 3, black)

def lettre_h(a,b):
    fb.vline(2+a,1+b, 11, black)
    fb.vline(3+a,1+b, 11, black)
    fb.vline(6+a,6+b, 4, black)
    fb.vline(7+a,7+b, 5, black)
    fb.vline(8+a,9+b, 3, black)
    fb.hline(4+a,6+b, 2, black)
    fb.hline(4+a,7+b, 2, black)

def lettre_i(a,b):
    fb.vline(3+a,2+b, 2, black)
    fb.vline(4+a,2+b, 2, black)
    fb.vline(3+a,5+b, 7, black)
    fb.vline(4+a,5+b, 7, black)

def lettre_j(a,b):
    fb.vline(6+a,1+b, 2, black)
    fb.vline(7+a,1+b, 2, black)
    fb.vline(6+a,5+b, 10, black)
    fb.vline(7+a,5+b, 9, black)
    fb.vline(5+a,12+b, 2, black)
    fb.vline(4+a,8+b, 2, black)
    fb.vline(4+a,11+b, 3, black)
    fb.vline(3+a,8+b, 5, black)
    fb.vline(2+a,9+b, 3, black)

def lettre_k(a,b):
    fb.vline(2+a,1+b, 11, black)
    fb.vline(3+a,1+b, 11, black)
    fb.hline(5+a,5+b, 2, black)
    fb.hline(4+a,6+b, 3, black)
    fb.hline(4+a,7+b, 2, black)
    fb.hline(4+a,8+b, 2, black)
    fb.hline(4+a,9+b, 3, black)
    fb.hline(5+a,10+b, 4, black)
    fb.hline(6+a,11+b, 3, black)

def lettre_l(a,b):
    fb.vline(2+a,1+b, 11, black)
    fb.vline(3+a,1+b, 11, black)

def lettre_m(a,b):
    fb.hline(1+a,6+b, 8, black)
    fb.hline(2+a,5+b, 6, black)
    fb.vline(1+a,7+b, 5, black)
    fb.vline(2+a,7+b, 5, black)
    fb.vline(4+a,7+b, 5, black)
    fb.vline(5+a,7+b, 5, black)
    fb.vline(7+a,7+b, 5, black)
    fb.vline(8+a,7+b, 5, black)

def lettre_n(a,b):
    fb.hline(4+a,6+b, 2, black)
    fb.hline(4+a,7+b, 2, black)
    fb.vline(2+a,5+b, 7, black)
    fb.vline(3+a,5+b, 7, black)
    fb.vline(6+a,6+b, 6, black)
    fb.vline(7+a,6+b, 6, black)

def lettre_o(a,b):
    fb.hline(4+a,4+b, 2, black)
    fb.hline(3+a,5+b, 4, black)
    fb.vline(2+a,6+b, 4, black)
    fb.vline(3+a,6+b, 5, black)
    fb.vline(4+a,10+b, 2, black)
    fb.vline(5+a,10+b, 2, black)
    fb.vline(6+a,6+b, 5, black)
    fb.vline(7+a,6+b, 4, black)

def lettre_p(a,b):
    fb.vline(2+a,4+b, 10, black)
    fb.vline(3+a,4+b, 10, black)
    fb.hline(4+a,4+b, 3, black)
    fb.hline(4+a,5+b, 4, black)
    fb.hline(6+a,6+b, 2, black)
    fb.hline(4+a,7+b, 4, black)
    fb.hline(4+a,8+b, 3, black)

def lettre_q(a,b):
    fb.vline(6+a,4+b, 10, black)
    fb.vline(7+a,4+b, 10, black)
    fb.hline(3+a,4+b, 3, black)
    fb.hline(2+a,5+b, 4, black)
    fb.hline(2+a,6+b, 2, black)
    fb.hline(2+a,7+b, 4, black)
    fb.hline(3+a,8+b, 3, black)

def lettre_r(a,b):
    fb.vline(2+a,4+b, 8, black)
    fb.vline(3+a,4+b, 8, black)
    fb.vline(4+a,5+b, 3, black)
    fb.vline(5+a,5+b, 3, black)
    fb.vline(6+a,4+b, 2, black)

def lettre_s(a,b):
    fb.hline(3+a,3+b, 5, black)
    fb.hline(2+a,4+b, 7, black)
    fb.hline(7+a,5+b, 2, black)
    fb.hline(2+a,5+b, 2, black)
    fb.hline(2+a,6+b, 5, black)
    fb.hline(3+a,7+b, 5, black)
    fb.hline(7+a,8+b, 2, black)
    fb.hline(7+a,9+b, 2, black)
    fb.hline(2+a,9+b, 2, black)
    fb.hline(2+a,10+b, 7, black)
    fb.hline(3+a,11+b, 5, black)

def lettre_t(a,b):
    fb.vline(3+a,4+b, 2, black)
    fb.vline(4+a,2+b, 9, black)
    fb.vline(5+a,2+b, 10, black)
    fb.vline(6+a,4+b, 2, black)
    fb.vline(7+a,4+b, 2, black)
    fb.vline(6+a,10+b, 2, black)
    fb.vline(7+a,9+b, 3, black)
    fb.vline(8+a,9+b, 3, black)

def lettre_u(a,b):
    fb.vline(2+a,4+b, 6, black)
    fb.vline(3+a,4+b, 7, black)
    fb.vline(7+a,4+b, 7, black)
    fb.vline(8+a,4+b, 6, black)
    fb.hline(3+a,10+b, 4, black)
    fb.hline(4+a,11+b, 3, black)

def lettre_v(a,b):
    fb.vline(2+a,4+b, 3, black)
    fb.vline(3+a,4+b, 6, black)
    fb.vline(4+a,7+b, 4, black)
    fb.vline(5+a,10+b, 2, black)
    fb.vline(6+a,7+b, 4, black)
    fb.vline(7+a,4+b, 6, black)
    fb.vline(8+a,4+b, 3, black)

def lettre_w(a,b):
    fb.vline(2+a,4+b, 6, black)
    fb.vline(3+a,4+b, 7, black)
    fb.vline(4+a,10+b, 2, black)
    fb.vline(5+a,8+b, 2, black)
    fb.vline(6+a,10+b, 2, black)
    fb.vline(7+a,4+b, 7, black)
    fb.vline(8+a,4+b, 6, black)

def lettre_x(a,b):
    fb.vline(2+a,3+b, 3, black)
    fb.vline(3+a,3+b, 4, black)
    fb.vline(4+a,5+b, 5, black)
    fb.vline(5+a,5+b, 3, black)
    fb.vline(6+a,5+b, 5, black)
    fb.vline(7+a,3+b, 4, black)
    fb.vline(8+a,3+b, 3, black)
    fb.vline(2+a,9+b, 3, black)
    fb.vline(3+a,8+b, 4, black)
    fb.vline(7+a,8+b, 4, black)
    fb.vline(8+a,9+b, 3, black)

def lettre_y(a,b):
    fb.vline(8+a,5+b, 7, black)
    fb.vline(7+a,5+b, 8, black)
    fb.vline(3+a,5+b, 4, black)
    fb.vline(2+a,5+b, 3, black)
    fb.vline(2+a,10+b, 2, black)
    fb.vline(3+a,10+b, 3, black)
    fb.hline(4+a,13+b, 3, black)
    fb.hline(4+a,12+b, 3, black)
    fb.hline(4+a,7+b, 3, black)
    fb.hline(4+a,8+b, 3, black)

def lettre_z(a,b):
    fb.hline(2+a,5+b, 7, black)
    fb.hline(2+a,6+b, 7, black)
    fb.hline(5+a,7+b, 2, black)
    fb.hline(4+a,8+b, 2, black)
    fb.hline(3+a,9+b, 2, black)
    fb.hline(2+a,10+b, 7, black)
    fb.hline(2+a,11+b, 7, black)

def conversion(number, a, b):
    number = str(number)
    a = str(a)
    b = str(b)
    liste_noms_symbols = ["space", "lettre_A", "lettre_B", "lettre_C", "lettre_D", "lettre_E", "lettre_F", "lettre_G", "lettre_H", "lettre_I", "lettre_J", "lettre_K", "lettre_L", "lettre_M", "lettre_N", "number_0", "lettre_P", "lettre_Q", "lettre_R", "lettre_S", "lettre_T", "lettre_U", "lettre_V", "lettre_W", "lettre_X", "lettre_Y", "lettre_Z", "point", "point2", "slash", "pourcent", "plus", "moins", "egal", "underscore", "interrogation", "exclamation", "number_0", "number_1", "number_2", "number_3", "number_4", "number_5", "number_6", "number_7", "number_8", "number_9", "lettre_a", "lettre_b", "lettre_c", "lettre_d", "lettre_e", "lettre_f", "lettre_g", "lettre_h", "lettre_i", "lettre_j", "lettre_k", "lettre_l", "lettre_m", "lettre_n", "lettre_o", "lettre_p", "lettre_q", "lettre_r", "lettre_s", "lettre_t", "lettre_u", "lettre_v", "lettre_w", "lettre_x", "lettre_y", "lettre_z"]
    liste_symbols = [" ", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", ".", ":", "/", "%", "+", "-", "=", "_", "?", "!", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" ]
    for i in liste_symbols:
        if i == number:
            phrasi = liste_noms_symbols[liste_symbols.index(i)] + "(" + a + "," + b + ")"    
    convert = eval(phrasi)
    return convert

def affichage(numbers,a,b=0):
    numbers = str(numbers)
    memo_b = b
    #sautx_4 = []
    sautx_6 = [" ", "!", "f", "i", "l", "r"] 
    sautx_8 = ["/", ".", "n", "o"]
    sautx_10 = [":", "?", "a", "b", "c", "d", "e", "g", "h", "j", "k", "m", "p", "q", "s", "t", "u", "v", "w", "x", "y", "z", "L"]
    sautx_11 = ["%", "=", "_", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "-"]
    sauty_2 = ["a", "b", "c", "d", "e", "f", "h", "i", "k", "l", "m", "n", "o", "r", "s", "t", "u", "v", "w", "x", "z"]
    sauty_3 = ["g", "j", "y"]
    sauty_4 = ["p", "q"]
    for i in numbers:
        i = str(i)
        if i in sauty_2:
            b += 2
        if i in sauty_3:
            b += 3
        if i in sauty_4:
            b += 4
        #if i in sautx_4:
         #   conversion(i,a,b)
          #  a += 4
        if i in sautx_6:
            conversion(i,a,b)
            a += 6
        if i in sautx_8:
            conversion(i,a,b)
            a += 8
        if i in sautx_10:
            conversion(i,a,b)
            a += 10
        if i in sautx_11:
            conversion(i,a,b)
            a += 11
        
        b = memo_b 
I haven't succed to put all this code in other file that I could import. It works fine, but It's too heavy for a main...
If someone could advise me on this point... (the difficulties comes from the eval function)
Thanks.

IHOXOHI
Posts: 112
Joined: Sat Apr 25, 2020 7:31 am

Re: epaper's waveshare lib

Post by IHOXOHI » Mon Nov 02, 2020 10:22 am

Youpi,

I have got it...
It was easy!!!?
I don't understand why anybody teach me how use a framebuff by the lib folder???

The first lines, and the last lines of my font.py file, in my lib folder, that I could import in the main:

Code: Select all

import framebuf

def __init__(self, a, b, fb, i):
    self.conversion = conversion(a,b,fb,i)
    self.buf = bytearray(400 * 300 // 8)
    self.fb = framebuf.FrameBuffer(buf, 400, 300, framebuf.MONO_HLSB)
    self.space = space(a,b,fb)
    self.lettre_A = lettre_A(a,b,fb)
    self.lettre_B = lettre_B(a,b,fb)
    self.lettre_C = lettre_C(a,b,fb)
    self.lettre_D = lettre_D(a,b,fb)
    self.lettre_E = lettre_E(a,b,fb)
    ...
    def conversion(a, b,fb,number):
    number = str(number)
    a = str(a)
    b = str(b)
    liste_noms_symbols = ["space", "lettre_A", "lettre_B", "lettre_C", ..., "lettre_w", "lettre_x", "lettre_y", "lettre_z"]
    liste_symbols = [" ", "A", "B", "C", "D", "E", ..., "r", "s", "t", "u", "v", "w", "x", "y", "z" ]
    for i in liste_symbols:
        if i == number:
            phrasi = liste_noms_symbols[liste_symbols.index(i)] + "(" + a + "," + b + "," + "fb" +")"    
    convert = eval(phrasi)
    return convert
How I call it in my main:

Code: Select all

def affichage(numbers,a,b=0):
    numbers = str(numbers)
    memo_b = b
    #sautx_4 = []
    sautx_6 = [" ", "!", "f", "i", "l", "r"] 
    sautx_8 = ["/", ".", "n", "o"]
    sautx_10 = [":", "?", "a", "b", "c", "d", "e", "g", "h", "j", "k", "m", "p", "q", "s", "t", "u", "v", "w", "x", "y", "z", "L"]
    sautx_11 = ["%", "=", "_", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "-"]
    sauty_2 = ["a", "b", "c", "d", "e", "f", "h", "i", "k", "l", "m", "n", "o", "r", "s", "t", "u", "v", "w", "x", "z"]
    sauty_3 = ["g", "j", "y"]
    sauty_4 = ["p", "q"]
    for i in numbers:
        i = str(i)
        if i in sauty_2:
            b += 2
        if i in sauty_3:
            b += 3
        if i in sauty_4:
            b += 4
        #if i in sautx_4:
         #   conversion(i,a,b)
          #  a += 4
        if i in sautx_6:
            ft.conversion(a,b,fb,i)
            a += 6
        if i in sautx_8:
            ft.conversion(a,b,fb,i)
            a += 8
        if i in sautx_10:
            ft.conversion(a,b,fb,i)
            a += 10
        if i in sautx_11:
            ft.conversion(a,b,fb,i)
            a += 11
        
        b = memo_b
        while 1:
            fb.fill(white)
            affichage("{}/{}".format(jour,mois),62,10)
            affichage("{}:{}".format(heure,minu),240,10)

            affichage("abcdefghijklmnopqrstuvwxyz",62,230)
            affichage("1234567890 ./:%+-=?_!",62,250)
            affichage("ABCDEFGHIJKLMNOPQRSTUVWXYZ",30,275)

            e.display_frame(buf)
            time.sleep(60)

For moment, no problem, but I haven't tested during 500 cycles of 60 sec yet... Once it will be, I will put the font.py file in "a place" on the www and post there the adress...

Works only with pyb-d which has enough memory capacity.
https://www.cosmocratie.fr/gallery.html
For others boards with less memory, you can reduce the number of symbols in the lib. I will add a shorted version...
Thanks for yours supports.

Post Reply