Tobias Müller 9 kuukautta sitten
vanhempi
commit
e3ff645265
3 muutettua tiedostoa jossa 9 lisäystä ja 4 poistoa
  1. 8 3
      Libs/LCD_Shield/__init__.py
  2. 1 1
      README.md
  3. BIN
      README.pdf

+ 8 - 3
Libs/LCD_Shield/__init__.py

@@ -415,7 +415,7 @@ class LCD:
         output = {"rows": rows, "row": 0x01, "column": 0x01, "auto_line_break": True, "separate": False}
         for key, val in keywords.items():
             if key not in keys:
-                raise ValueError(f"Keyword \"{key}\" is unknown!")
+                raise KeyError(f"Keyword \"{key}\" is unknown!")
             elif key == "row":
                 if not isinstance(val, int):
                     raise ValueError(f"Value \"{val}\" of keyword \"{key}\" is not type \"int\"!")
@@ -540,9 +540,14 @@ class LCD:
                    self.__lcd_control_para["DISPLAY_ROW_" + str(line)],
                    self.__lcd_control_para["CONTROL_BYTE_RS"])
             self.__i2c.writeto(self.__i2c_address,bytes(tmp))
+            sleep_us(10000)
             tmp = self.__i2c.readfrom(self.__i2c_address,11)
             tmp = list(tmp[1:])
             tmp = [chr(tmp[i]) for i in range(0, len(tmp))]
+            if ("row" in keywords.keys() or "column" in keywords.keys()) and line != row:
+                tmp = [""]
+            if "column" in keywords.keys() and line == row:
+                tmp = tmp[column - 0x01]
             buffer.append("".join(tmp))
             sleep_us(10000)
         if not separate:
@@ -553,5 +558,5 @@ class LCD:
             return buffer
 
 if __name__ == "__main__":
-    lcd = LCD()
-    lcd.print("Hallöle")
+    lcd = LCD(lcd_line_mode=0x03)
+    lcd.print("Hochschule  Anhalt")

+ 1 - 1
README.md

@@ -1,4 +1,4 @@
-[![](Pics/HSA-Banner.png)](https://www.hs-anhalt.de)
+![](Pics/HSA-Banner.png)
 
 # LCD-Shield-Python
 

BIN
README.pdf