Ejemplo n.º 1
0
printer.printImage(Image.open('hello.jpeg'), True)
printer.print(
    "1. Afficher meteo et bourse \n  Hold : eteindre \n\n2. Imprimer les tweet \n\n3. Changer le type de tweet\n Hold : desactiver"
)
printer.feed(6)

while (True):

    buttonState1 = GPIO.input(buttonPin1)
    buttonState2 = GPIO.input(buttonPin2)
    buttonState4 = GPIO.input(buttonPin4)
    t1 = time.time()
    t2 = time.time()
    t4 = time.time()

    sancho = printer.hasPaper()
    if int(sancho) != 1:
        GPIO.output(ledPin1, GPIO.LOW)
        time.sleep(1)
        GPIO.output(ledPin1, GPIO.HIGH)
        GPIO.output(ledPin4, GPIO.LOW)
        time.sleep(1)
        GPIO.output(ledPin4, GPIO.HIGH)

    if buttonState1 != prevButtonState1:
        prevButtonState1 = buttonState1  # Si l'etat a changé, nouveau etat/temps
        prevTime = t1
    else:  # si il ne change pas
        if (t1 - prevTime) >= holdTime:  # resté appuyé ?
            if holdEnable1 == True:  # le bouton est il appuyé
                hold2()  # action resté appuyé
Ejemplo n.º 2
0
#!/usr/bin/python

from Adafruit_Thermal import *
import sys

printer = Adafruit_Thermal("/dev/serial0", 19200, timeout=5)

if not printer.hasPaper():
    sys.exit(1)

for line in sys.argv[1:]:
    printer.println(line)
printer.feed(3)
Ejemplo n.º 3
0
#!/usr/bin/python

from Adafruit_Thermal import *

printer = Adafruit_Thermal("/dev/ttyAMA0", 19200, timeout=5)

if printer.hasPaper() == True:
     print"There is paper in the printer"
else:
     print "There is no paper in the printer"

# Test inverse on & off
printer.inverseOn()
printer.println("Inverse ON")
printer.inverseOff()

# Test character double-height on & off
printer.doubleHeightOn()
printer.println("Double Height ON")
printer.doubleHeightOff()

# Set justification (right, center, left) -- accepts 'L', 'C', 'R'
printer.justify('R')
printer.println("Right justified")
printer.justify('C')
printer.println("Center justified")
printer.justify('L')
printer.println("Left justified")

# Test more styles
printer.boldOn()