server_microphone_oled.py aktualisiert

This commit is contained in:
2026-03-07 19:12:32 +00:00
parent 36c8e717a4
commit 80bdead749

View File

@@ -50,7 +50,7 @@ async def run_test():
run_stop_only_once_flag = True
# I2C-Schnittstelle initialisieren (Port 1, Adresse 0x3C)
serial = i2c(port=1, address=0x3C)
serial = i2c(port=5, address=0x3C)
# Display-Objekt erstellen (128x64 Blue&Yellow-Display)
oled_device = ssd1306(serial, width=128, height=64)
@@ -60,9 +60,11 @@ async def run_test():
finalResult = await websocket.recv()
# oled ausgabe
with canvas(oled_device) as draw:
oled_string = finalResult[-20:].replace('partial','').replace('[','').replace(']','').replace('\n','')
oled_string = finalResult[-45:].replace('partial','').replace('[','').replace(']','').replace('\n','')
oled_out = [oled_string[i:i+15] for i in range(0, len(oled_string), 15)]
oled_out = "\n".join(oled_out)
draw.text((0,0), "Erwin hoert:", fill="white")
draw.text((0, 15), oled_string, fill="white")
draw.text((0, 15), oled_out, fill="white")
#print(finalResult)
if "licht" in finalResult and "an" in finalResult and activation_word in finalResult and run_stop_only_once_flag:
print("SCHALTER EIN!")