diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0367919 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +db.ini +*.bak +LCD1602.py +__pycache__ diff --git a/degdisp.py b/degdisp.py deleted file mode 100755 index 32f8da4..0000000 --- a/degdisp.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python3 -# encoding: utf-8 - -import time -import configparser -import logging -import LCD1602 -try: - import smbus2 -except ImportError: # Wenn smbus2 nicht zu importieren ist, nehmen wir smbus - from smbus import SMBus -import mysql.connector - -port = 1 -adresse_lcd1602 = 0x25 -deg = 0o1212 - -logging.basicConfig( format='%(asctime)s [%(levelname)s] %(funcName)s: %(message)s', level=logging.DEBUG) - - -def info(msg): - logging.info(msg) - -def debug(msg): - logging.debug(msg) - -def print_weather(): - lcd.setCursor(0, 0) - lcd.printout('0o{0:o}'.format(deg)) - - -#LCD1602 initialisieren -lcd=LCD1602.LCD1602(16,2) - -try: - while True: - print_weather() -except(KeyboardInterrupt): - lcd.clear() - diff --git a/wdisp.py b/wdisp.py index 83901f3..7e0c46e 100755 --- a/wdisp.py +++ b/wdisp.py @@ -27,11 +27,13 @@ def debug(msg): def print_weather(temperature, humidity, pressure): lcd.setCursor(0, 0) - lcd.printout('{:05.2f}\223C'.format(temperature) - lcd.printout(' {:05.2f}hPa'.format(pressure)) + lcd.printout('T:{:5.1f}'.format(temperature)) + lcd.printout(' D:{:5.1f}'.format(pressure)) lcd.setCursor(0, 1) - lcd.printout('{:05.2f}%'.format(humidity)) + lcd.printout('F:{:5.2f}%'.format(humidity)) + + # Datenbankverbindung herstellen. config = configparser.ConfigParser() config.read('db.ini')