From 16fc4aa6826baf6e2df3d5f8b30b07bed8e5acae Mon Sep 17 00:00:00 2001 From: janeptrv Date: Tue, 3 Nov 2020 21:08:49 -0500 Subject: [PATCH] test backlight changes --- leds.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/leds.py b/leds.py index 28f9c29..327c011 100644 --- a/leds.py +++ b/leds.py @@ -53,7 +53,7 @@ class Adafruit_CharLCD: LCD_5x10DOTS = 0x04 LCD_5x8DOTS = 0x00 - def __init__(self, pin_rs=24, pin_e=23, pins_db=[17, 18, 27, 22], GPIO=None): + def __init__(self, pin_rs=24, pin_e=23, pin_b=04, pins_db=[17, 18, 27, 22], GPIO=None): # Emulate the old behavior of using RPi.GPIO if we haven't been given # an explicit GPIO interface to use if not GPIO: @@ -61,16 +61,20 @@ class Adafruit_CharLCD: self.GPIO = GPIO self.pin_rs = pin_rs self.pin_e = pin_e + self.pin_b = pin_b self.pins_db = pins_db self.GPIO.setwarnings(False) self.GPIO.setmode(GPIO.BCM) self.GPIO.setup(self.pin_e, GPIO.OUT) self.GPIO.setup(self.pin_rs, GPIO.OUT) + self.GPIO.setup(self.pin_b, GPIO.OUT) for pin in self.pins_db: self.GPIO.setup(pin, GPIO.OUT) + self.GPIO.output(self.pin_b, True) + self.write4bits(0x33) # initialization self.write4bits(0x32) # initialization self.write4bits(0x28) # 2 line 5x7 matrix @@ -118,13 +122,13 @@ class Adafruit_CharLCD: def noDisplay(self): """ Turn the display off (quickly) """ - + self.GPIO.output(self.pin_b, False) self.displaycontrol &= ~self.LCD_DISPLAYON self.write4bits(self.LCD_DISPLAYCONTROL | self.displaycontrol) def display(self): """ Turn the display on (quickly) """ - + self.GPIO.output(self.pin_b, True) self.displaycontrol |= self.LCD_DISPLAYON self.write4bits(self.LCD_DISPLAYCONTROL | self.displaycontrol)