import st7565
import xglcd_font as font
import math
import time

neato = font.XglcdFont('/home/pi/Pi-ST7565/fonts/Neato5x7.c', 5, 7)
glcd = st7565.Glcd(rgb=[21, 20, 16])
glcd.init()
x0, y0 = 63, 31

def get_face_xy(angle, radius):
    """
    Get x,y coordinates on face at specified angle and radius 
    """
    theta = math.radians(angle)
    x = int(x0 + radius * math.cos(theta))
    y = int(y0 + radius * math.sin(theta))
    return x, y

def draw_face():
    # Outline
    glcd.draw_circle(x0, y0, 31)
    # Ticks
    for angle in range(30, 331, 30):
        glcd.draw_line(x0, y0, *get_face_xy(angle, 29))
    # Clear center of circle
    glcd.fill_circle(x0, y0, 25, color=0)
    # Numbers
    glcd.draw_string("12", neato, x0 - 5, y0 - 29, spacing=0)
    glcd.draw_letter("3", neato, x0 + 25, y0 - 3)
    glcd.draw_letter("6", neato, x0 - 2, y0 + 23)
Exemple #2
0
import st7565
import xglcd_font as font

neato = font.XglcdFont(
    '/home/pi/Pi-ST7565/fonts/Neato5x7.c', 5,
    7)  #5, 7 refers to the pixel size of each character. This file must exist
glcd = st7565.Glcd(rgb=[21, 20, 16])  #Don't change these numbers
glcd.init()

glcd.draw_string('abcdefghijklmnopqrstu', neato, 0, 0, spacing=1)
glcd.draw_string('ABCDEFGHIJKLMNOPQRSTU', neato, 0, 8, spacing=1)
glcd.draw_string('0123456789,.;/[]!@#$%', neato, 0, 16, spacing=1)

glcd.draw_string('abcdefghijklmnopqrstu', neato, 0, 24, spacing=1, invert=1)
glcd.flip()