Beispiel #1
0
class DisplayLCD(object):

    # Raspberry Pi configuration:
    lcd_rs = 27  # Change this to pin 21 on older revision Raspberry Pi's
    lcd_en = 22
    lcd_d4 = 25
    lcd_d5 = 24
    lcd_d6 = 23
    lcd_d7 = 18
    lcd_red = 4
    lcd_green = 17
    lcd_blue = 7  # Pin 7 is CE1

    # Define LCD column and row size for 16x2 LCD.
    lcd_columns = 16
    lcd_rows = 2

    # Initialize the LCD using the pins above.
    lcd = LCD.Adafruit_RGBCharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6,
                                  lcd_d7, lcd_columns, lcd_rows, lcd_red,
                                  lcd_green, lcd_blue)

    def updateDisplay(self, pData):
        self.lcd.clear()
        self.lcd.set_color(pData.colorR, pData.colorG, pData.colorB)
        self.lcd.message(pData.message)

    def sayGoodbye(self):
        self.lcd.clear()
        self.lcd.set_color(0, 0, 0)
        self.lcd.message("No printing\n" + "process")
Beispiel #2
0
def lcdinit():
    global lcd
    lcd = LCD.Adafruit_RGBCharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6,
                                  lcd_d7, lcd_columns, lcd_rows, lcd_red,
                                  lcd_green, lcd_blue)
    lcd.clear()
    lcd.set_color(1.0, 0.0, 1.0)
    lcd.message("   Hi! I'm Mandy.\n\n  Say hello to me.")
Beispiel #3
0
def threadLCD():
    # Initialize the LCD using the pins above.
    lcd = LCD.Adafruit_RGBCharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6,
                                  lcd_d7, lcd_columns, lcd_rows, lcd_red,
                                  lcd_green, lcd_blue)

    # Show some basic colors.
    lcd.set_color(1.0, 0.0, 0.0)
    lcd.clear()
    #lcd.message('RED')
    lcd.message('CRIME ALERT')
    time.sleep(2.0)
    lcd.set_color(1.0, 0.0, 0.0)
    lcd.clear()
    message = 'Scroll'
    lcd.message('REPORTS Juan Perez\n ZONA 1, Calle Tec')
    for i in range(lcd_columns - len(message)):
        time.sleep(1)
        lcd.move_left()

    lcd.set_color(0.0, 0.0, 1.0)
    lcd.clear()
    ##lcd.message('BLUE')
    time.sleep(1.0)
    lcd.message('HEALTH EMERGENCY')
    time.sleep(2.0)
    lcd.set_color(0.0, 0.0, 1.0)
    lcd.clear()
    message = 'Scroll'
    lcd.message('REPORTS Mr. Raymundo\n ZONE 2, STREET Rotonda')
    for i in range(lcd_columns - len(message)):
        time.sleep(1)
        lcd.move_left()

    lcd.set_color(1.0, 1.0, 0.0)
    lcd.clear()
    ##lcd.message('YELLOW')
    time.sleep(2.0)
    lcd.blink(True)
    lcd.message('SUSPICIOUS SITUATION')
    time.sleep(2.0)

    lcd.set_color(1.0, 1.0, 0.0)
    lcd.clear()
    message = 'Scroll'
    lcd.message('REPORTS Mrs. Rosa Lozano\n ZONE 5, STREET Rotonda')
    for i in range(lcd_columns - len(message)):
        time.sleep(1)
        lcd.move_left()
Beispiel #4
0
def threadLCD():
    # Initialize the LCD using the pins above.
    lcd = LCD.Adafruit_RGBCharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6,
                                  lcd_d7, lcd_columns, lcd_rows, lcd_red,
                                  lcd_green, lcd_blue)

    # Show some basic colors.
    lcd.set_color(1.0, 0.0, 0.0)
    lcd.clear()
    lcd.message('RED')
    time.sleep(3.0)

    lcd.set_color(0.0, 1.0, 0.0)
    lcd.clear()
    lcd.message('GREEN')
    time.sleep(3.0)

    lcd.set_color(0.0, 0.0, 1.0)
    lcd.clear()
    lcd.message('BLUE')
    time.sleep(3.0)

    lcd.set_color(1.0, 1.0, 0.0)
    lcd.clear()
    lcd.message('YELLOW')
    time.sleep(3.0)

    lcd.set_color(0.0, 1.0, 1.0)
    lcd.clear()
    lcd.message('CYAN')
    time.sleep(3.0)

    lcd.set_color(1.0, 0.0, 1.0)
    lcd.clear()
    lcd.message('MAGENTA')
    time.sleep(3.0)

    lcd.set_color(1.0, 1.0, 1.0)
    lcd.clear()
    lcd.message('WHITE')
    time.sleep(3.0)
Beispiel #5
0
    def __init__(self):
        # Ecran vert

        self.led.start(
            100)  # Allume la LED pour prévenir que la voiture est prête

        # Définir les pins en sortie
        outputs = [
            adresses["Red"], adresses["Green"], adresses["Blue"],
            adresses["V0"]
        ]
        GPIO.setup(outputs, GPIO.OUT)

        # Contraste de l'écran LCD
        self.pwm_contrast = GPIO.PWM(adresses["V0"], 980)
        self.contrast = 30
        self.pwm_contrast.start(30)

        self.lcd = LCD.Adafruit_RGBCharLCD(adresses["RS"], adresses["Enable"],
                                           adresses["DB4"], adresses["DB5"],
                                           adresses["DB6"], adresses["DB7"],
                                           16, 2, adresses["Red"],
                                           adresses["Green"], adresses["Blue"])
Beispiel #6
0
lcd_rows = 2

# Alternatively specify a 20x4 LCD.
# lcd_columns = 20
# lcd_rows    = 4

# Initialize GPIO
gpio = GPIO.get_platform_gpio()
# Initialize One Wire Thermal Sensor
sensor = W1ThermSensor()

# Initialize the LCD using the pins
lcd = LCD.Adafruit_RGBCharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7,
                              lcd_columns,
                              lcd_rows, lcd_red, lcd_green, lcd_blue,
                              gpio=GPIO.get_platform_gpio(),
                              invert_polarity=True,
                              enable_pwm=True,
                              pwm=PWM.get_platform_pwm(pwmtype="softpwm"),
                              initial_color=(1.0, 1.0, 1.0))


# Blue startup screen
lcd.set_color(0.0, 0.0, 1.0)
lcd.clear()

# Create Farenheight Degree Symbol
lcd.create_char(1, [0b11000,
                    0b11000,
                    0b00000,
                    0b00111,
                    0b00100,
Beispiel #7
0
RotaryEncoder = input.RotaryEncoder.Worker(RE_A, RE_B)
RotaryEncoderButton = input.Button.Worker(Button_RE)
Button = input.Button.Worker(Button_Left)
PowerButton = input.Button.Worker(Button_Power)

RotaryEncoder.start()
RotaryEncoderButton.start()
Button.start()
PowerButton.start()

lcd = Adafruit_CharLCD.Adafruit_RGBCharLCD(lcd_rs,
                                           lcd_en,
                                           lcd_d4,
                                           lcd_d5,
                                           lcd_d6,
                                           lcd_d7,
                                           lcd_columns,
                                           lcd_rows,
                                           lcd_red,
                                           lcd_green,
                                           lcd_blue,
                                           enable_pwm=True)
lcd.set_color(LCD_red, LCD_green, LCD_blue)

miniplayer = interface.Interface(lcd, lms_server, lms_player)
#miniplayer.start()

miniplayer.ui.optimize_redraw = True
miniplayer.ui.print_all()

while True:
    if Button.get_response():
Beispiel #8
0
    return ipMessage


if __name__ == u"__main__":
    st = 20

    try: 
        if True:
            lcd = LCD.Adafruit_CharLCDPlate()
        else:
            gpio = MCP.MCP23017()
            logger.debug(u"Have gpio")
            # Initialize the LCD using the pins
            lcd = LCD.Adafruit_RGBCharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6,
                                              lcd_d7, lcd_columns, lcd_rows, lcd_red,
                                              lcd_green, lcd_blue, gpio=gpio)

        logger.debug(u"Have lcd. follow the white rabbit")

        # Set backlight color and turn on
        lcd.clear()
        lcd.set_color(1, 0, 0) 
        lcd.set_backlight(1)

    except Exception, msg:
        logger.debug(u"%s" % msg)

    while True:
        try:
            hour, minute, dtMessage = getDateTime()
LCD_D7 = 5
LCD_RED = 6
LCD_GREEN = 7
LCD_BLUE = 8

LCD_COLUMNS = 20
LCD_ROWS = 4

GPIO = MCP.MCP23017(busnum=2)

LCD = LC.Adafruit_RGBCharLCD(LCD_RS,
                             LCD_EN,
                             LCD_D4,
                             LCD_D5,
                             LCD_D6,
                             LCD_D7,
                             LCD_COLUMNS,
                             LCD_ROWS,
                             LCD_RED,
                             LCD_GREEN,
                             LCD_BLUE,
                             gpio=GPIO)


def read_config(filename):
    config = None
    config = configparser.RawConfigParser()
    config.read(filename)
    return config


def main():
Beispiel #10
0
import Adafruit_CharLCD as LCD
import Adafruit_GPIO.MCP230xx as MCP
gpio = MCP.MCP23017()
lcd = LCD.Adafruit_RGBCharLCD(0, 1, 2, 3, 4, 5,16, 2, 6, 7, 8,gpio=gpio)

Beispiel #11
0
# Setup
with open("/home/pi/home-assistant-temperature-monitor/config.json"
          ) as json_file:
    config = json.load(json_file)

GPIO.setmode(GPIO.BCM)
GPIO.setup(config['button_pin'], GPIO.IN)
GPIO.setup(config['led_pin'], GPIO.OUT)
GPIO.output(config['led_pin'], GPIO.LOW)
bus = smbus.SMBus(1)
lcd = LCD.Adafruit_RGBCharLCD(config['lcd_rs_pin'],
                              config['lcd_en_pin'],
                              config['lcd_d4_pin'],
                              config['lcd_d5_pin'],
                              config['lcd_d6_pin'],
                              config['lcd_d7_pin'],
                              config['lcd_columns'],
                              config['lcd_rows'],
                              config['lcd_red_pin'],
                              config['lcd_green_pin'],
                              config['lcd_blue_pin'],
                              enable_pwm=True)

# Some defaults
prev_rgb = (1, 1, 1)
status = 'off'
target_temp = 0
temp = 0
out_temp = 0
humid = 0
out_humid = 0
bus_delay = 0.025
    elif background is 'Green':
        screen.set_color(0, 1, 0)
    elif background is 'White':
        screen.set_color(1, 1, 1)
    else:
        screen.set_color(1, 1, 1)
    screen.clear()
    screen.message(messageText)
    os.system('clear')
    print(messageText)
    
    
# HARDWARE SETUP
# -----------------
# Create instances of LCD object and begin communications
lcd = LCD.Adafruit_RGBCharLCD(LCD_RS, LCD_EN, LCD_D4, LCD_D5, LCD_D6, 
                           LCD_D7, LCD_COLS, LCD_ROWS, LCD_RED, LCD_GREEN, LCD_BLUE)

# Create instances of PN532 object and begin communications reporting back version
pn532 = PN532.PN532(cs=PN532_SSEL, sclk=PN532_SCLK, mosi=PN532_MOSI, miso=PN532_MISO)
pn532.begin()
ic, ver, rev, support = pn532.get_firmware_version()
tempMessage = ('Found Card Reader\nFirmware version {0}.{1}'.format(ver, rev))
lcd_message(lcd,'Blue',tempMessage)
time.sleep(3)

# Configure PN532 to communicate with MiFare cards.
pn532.SAM_configuration()

# Configure GPIO pins on the pi.
GPIO.setup([RELAY1], GPIO.OUT)