Browse Source

wdisp.py fertig.

master 1.0
Olli Graf 1 year ago
parent
commit
752f7e252d
  1. 4
      .gitignore
  2. 40
      degdisp.py
  3. 8
      wdisp.py

4
.gitignore

@ -0,0 +1,4 @@
db.ini
*.bak
LCD1602.py
__pycache__

40
degdisp.py

@ -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()

8
wdisp.py

@ -27,11 +27,13 @@ def debug(msg):
def print_weather(temperature, humidity, pressure): def print_weather(temperature, humidity, pressure):
lcd.setCursor(0, 0) lcd.setCursor(0, 0)
lcd.printout('{:05.2f}\223C'.format(temperature) lcd.printout('T:{:5.1f}'.format(temperature))
lcd.printout(' {:05.2f}hPa'.format(pressure)) lcd.printout(' D:{:5.1f}'.format(pressure))
lcd.setCursor(0, 1) lcd.setCursor(0, 1)
lcd.printout('{:05.2f}%'.format(humidity)) lcd.printout('F:{:5.2f}%'.format(humidity))
# Datenbankverbindung herstellen. # Datenbankverbindung herstellen.
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read('db.ini') config.read('db.ini')

Loading…
Cancel
Save