Huhu,
Ich bin noch nicht so bewandert,was Python angeht und bräuchte etwas hilfe
Ich habe mir aus einigen Beispielen ein Pythonprogramm gebastelt.
Das was momentan Angezeigt werden soll, funktioniert auch.
Nun stoße ich auf das Problem, dass ich die angezeigten Ausgaben, in meinem fall die Uhrzeit manuell durch erneutes öffnen des Programms aktuallisieren muss.
Wie bekomme ich eine laufende Uhr auf dem Display hin?
Code
#import
import RPi.GPIO as GPIO
import time
# Define GPIO to LCD mapping
LCD_RS = 7
LCD_E = 8
LCD_D4 = 25
LCD_D5 = 24
LCD_D6 = 23
LCD_D7 = 18
# Define some device constants
LCD_WIDTH = 16 # Maximum characters per line
LCD_CHR = True
LCD_CMD = False
LCD_LINE_1 = 0x80 # LCD RAM address for the 1st line
LCD_LINE_2 = 0xC0 # LCD RAM address for the 2nd line
# Timing constants
E_PULSE = 0.00005
E_DELAY = 0.00005
def main():
# Main program block
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM) # Use BCM GPIO numbers
GPIO.setup(LCD_E, GPIO.OUT) # E
GPIO.setup(LCD_RS, GPIO.OUT) # RS
GPIO.setup(LCD_D4, GPIO.OUT) # DB4
GPIO.setup(LCD_D5, GPIO.OUT) # DB5
GPIO.setup(LCD_D6, GPIO.OUT) # DB6
GPIO.setup(LCD_D7, GPIO.OUT) # DB7
# Initialise display
lcd_init()
# Send some test
lcd_byte(LCD_LINE_1, LCD_CMD)
lcd_string("Rasbperry Pi")
lcd_byte(LCD_LINE_2, LCD_CMD)
lcd_string(time.strftime("%H:%M:%S"))
time.sleep(0)
Alles anzeigen