summaryrefslogtreecommitdiff
path: root/bin/kasper_source.py
diff options
context:
space:
mode:
Diffstat (limited to 'bin/kasper_source.py')
-rw-r--r--bin/kasper_source.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/kasper_source.py b/bin/kasper_source.py
index d878f6c..b7d8060 100644
--- a/bin/kasper_source.py
+++ b/bin/kasper_source.py
@@ -71,6 +71,8 @@ microphone = speech.Microphone()
71 71
72# Display Functions 72# Display Functions
73def display_cpu_info(): 73def display_cpu_info():
74 # clearing the display before accessing it
75 lcd.clear()
74 """Display CPU load and temperature on the LCD.""" 76 """Display CPU load and temperature on the LCD."""
75 while True: 77 while True:
76 load = os.getloadavg()[0] # 1-minute load average 78 load = os.getloadavg()[0] # 1-minute load average
@@ -82,6 +84,8 @@ def display_cpu_info():
82 84
83 85
84def display_uptime(): 86def display_uptime():
87 # clearing the display before accessing it
88 lcd.clear()
85 """Display system uptime on the LCD.""" 89 """Display system uptime on the LCD."""
86 with open("/proc/uptime") as f: 90 with open("/proc/uptime") as f:
87 uptime_seconds = float(f.readline().split()[0]) 91 uptime_seconds = float(f.readline().split()[0])
@@ -91,6 +95,8 @@ def display_uptime():
91 95
92 96
93def recognize_speech(): 97def recognize_speech():
98 # clearing the display before accessing it
99 lcd.clear()
94 """Capture and transcribe speech input.""" 100 """Capture and transcribe speech input."""
95 try: 101 try:
96 with microphone as source: 102 with microphone as source:
@@ -118,6 +124,8 @@ OPTIONS = {
118 124
119 125
120def main(): 126def main():
127 # clearing the display before doing anything
128 lcd.clear()
121 # Main program loop to accept user commands. 129 # Main program loop to accept user commands.
122 print("WELCOME TO THE I2C COMMAND LINE CENTER") 130 print("WELCOME TO THE I2C COMMAND LINE CENTER")
123 print("Options:", ", ".join(OPTIONS.keys())) 131 print("Options:", ", ".join(OPTIONS.keys()))