Exemplo n.º 1
0
    def _init_lcd(self):
        lcd = CharLCD(i2c_expander='PCF8574',
                      address=self._rsc.lcd_address,
                      port=1,
                      cols=20,
                      rows=4,
                      dotsize=8,
                      charmap='A00',
                      auto_linebreaks=True,
                      backlight_enabled=False)
        #self._lcd.backlight_enabled = False
        lcd.cursor_mode = "hide"
        wifi_char = (0b00000, 0b11111, 0b00000, 0b01110, 0b00000, 0b00100,
                     0b00100, 0b00000)
        backspace_char = (0b00000, 0b00000, 0b00111, 0b01001, 0b10001, 0b01001,
                          0b00111, 0b00000)
        enter_char = (0b00000, 0b00001, 0b00101, 0b01001, 0b11111, 0b01000,
                      0b00100, 0b00000)

        lcd.create_char(0, wifi_char)
        lcd.create_char(1, backspace_char)
        lcd.create_char(2, enter_char)
        return lcd
Exemplo n.º 2
0
from RPLCD.i2c import CharLCD
from time import sleep
from threading import Thread

lcd = CharLCD(i2c_expander='PCF8574',
              address=0x3f,
              port=1,
              cols=20,
              rows=4,
              dotsize=8,
              charmap='A02',
              auto_linebreaks=True,
              backlight_enabled=False)

lcd.cursor_mode = "hide"
lcd.write_string('PiNet -> Nexus')
lcd.cursor_pos = (2, 0)
lcd.write_string('BORG Assimilated')
lcd.cursor_pos = (3, 0)
lcd.write_string("{:^20}".format("PolyHub Listening..."))


def turnOnForSeconds(seconds=5):
    backlightThread = Thread(target=timedBacklight, args=(seconds, ))
    backlightThread.start()


def timedBacklight(seconds):
    lcd.backlight_enabled = True
    sleep(seconds)
Exemplo n.º 3
0
    input = raw_input
except NameError:
    pass

try:
    unichr = unichr
except NameError:
    unichr = chr


lcd = CharLCD(0x3f)
# see note in test_16x2.py about configuring your backlight, if you have one

input('Display should be blank. ')

lcd.cursor_mode = CursorMode.blink
input('The cursor should now blink. ')

lcd.cursor_mode = CursorMode.line
input('The cursor should now be a line. ')

lcd.write_string('Hello world!')
input('"Hello world!" should be on the LCD. ')

assert lcd.cursor_pos == (0, 12), 'cursor_pos should now be (0, 12)'

lcd.cursor_pos = (1, 0)
lcd.write_string('2')
lcd.cursor_pos = (2, 0)
lcd.write_string('3')
lcd.cursor_pos = (3, 0)
Exemplo n.º 4
0
# https://rplcd.readthedocs.io/en/latest/getting_started.html
from RPLCD.i2c import CharLCD
import time

lcd = CharLCD(i2c_expander='PCF8574',
              address=0x27,
              port=1,
              cols=16,
              rows=2,
              dotsize=8,
              charmap='A02',
              auto_linebreaks=False,
              backlight_enabled=True)

while (True):
    lcd.clear()
    lcd.cursor_pos = (0, 0)
    lcd.write_string("Say something")
    lcd.cursor_pos = (1, 0)
    lcd.cursor_mode = 'blink'
    entry = input()
    lcd.write_string(entry)
    time.sleep(3)