summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorAbdellah El Morabit <nsrddyn@gmail.com>2024-11-07 17:00:19 +0100
committerAbdellah El Morabit <nsrddyn@gmail.com>2024-11-07 17:00:19 +0100
commit32ec9336088799c42d8aa7ace6648802e1b267cf (patch)
treebc6d718631a2f2a210b4cde462a5f7f97bd6b613 /bin
parentfa7007d00c04fc73f668e2b7f339c3f60a64d055 (diff)
did alot of designing and testing out on a linux machine
Diffstat (limited to 'bin')
-rw-r--r--bin/icon.pngbin0 -> 3754 bytes
-rw-r--r--bin/kasper_gui.py10
-rw-r--r--bin/kasper_source.py (renamed from bin/script.py)70
3 files changed, 72 insertions, 8 deletions
diff --git a/bin/icon.png b/bin/icon.png
new file mode 100644
index 0000000..c372c49
--- /dev/null
+++ b/bin/icon.png
Binary files differ
diff --git a/bin/kasper_gui.py b/bin/kasper_gui.py
new file mode 100644
index 0000000..2826638
--- /dev/null
+++ b/bin/kasper_gui.py
@@ -0,0 +1,10 @@
+import tkinter
+from tkinter import PhotoImage
+
+display = tkinter.Tk()
+display.title("Kasper")
+photo = PhotoImage(file = "icon.png")
+display.iconphoto(False, photo)
+
+
+display.mainloop() \ No newline at end of file
diff --git a/bin/script.py b/bin/kasper_source.py
index 5c33638..d8b0599 100644
--- a/bin/script.py
+++ b/bin/kasper_source.py
@@ -1,5 +1,7 @@
from smbus2 import SMBus
from time import sleep
+from gpiozero import CPUTemperature
+from rpi_lcd import LCD
import speech_recognition as sr
import sounddevice
@@ -78,32 +80,84 @@ class LCD(object):
def clear(self):
self.write(CLEAR_DISPLAY)
-
-
-LCD = LCD()
+LCD_DISPLAY = LCD()
VOICE_REC = sr.Recognizer()
MIC = sr.Microphone()
PROCES_LOAD = os.getloadavg()
TIME = current_time.time()
UPTIME = time.CLOCK_UPTIME()
+CPU_TEMP = CPUTemperature()
+
+# clearing the lcd from any text that was on it before the program started to ensure smooth operations
+lcd.clear()
+# Listening to the user's voice and putting it into a variable
+def listen_voice():
+ global audio
+ with mic as source:
+ r.adjust_for_ambient_noise(source)
+ audio = r.listen(source)
+ return audio
+# Transcribing the audio to text and printing it out
+# Using the Google Speech Recognizer
+def recognize_speech(audio):
+ try:
+ words = r.recognize_google(audio)
+ LCD_DISPLAY.text(words, 1)
+ print(f"Printing on screen: {words}")
+ except sr.UnknownValueError:
+ LCD_DISPLAY.text(ERROR_BAD_REQUEST, 1)
+ print(ERROR_BAD_REQUEST)
+ except sr.RequestError:
+ LCD_DISPLAY.text(ERROR_UNAUTHORIZED, 1)
+ print(ERROR_UNAUTHORIZED)
def CPU_INFO():
+ print("you chose to display the cpou")
while (True):
LCD.text(PROCES_LOAD(),1,left)
def CURRENT_TIME():
while True:
- backlight_mode = true
- LCD.text(UPTIME,1,left)
+ backlight_mode = True
LCD.text(TIME,2,center)
-
+def UPTIME():
+ while True:
+ LCD.text(UPTIME,1,left)
+
+def CPU_TEMP():
+ while True:
+ LCD.text(cpu.temperature)
+
+def CPU_LOAD():
+ backlight_mode = True
+ LCD.text(PROCES_LOAD,1,left)
+def NOTES():
+ count = 0
+ user_notes = input()
+ for i in user_notes:
+ while count < 20:
+ lcd.text(i,1,left)
+ count += 1
-OPTIONS = ["CPU_CLOCK", "TIME", "UPTIME", "CPU_TEMP", "CPU LOAD", "NOTES"]
+
+OPTIONS = ["CPU_CLOCK", "TIME", "UPTIME", "CPU_TEMP", "CPU_LOAD", "NOTES", "SPEECH_TRANSCRIBER"]
-def USER_GUI():
+def PROGRAM(USER_INPUT):
print("WELCOME TO THE I2C COMMAND LINE CENTER \n WHAT DO YOU WISH TO DO? ")
print(OPTIONS)
+
+ FOUND = False
+ while FOUND == False:
+
+ USER_INPUT = input().upper()
+ for i in OPTIONS:
+ if i == USER_INPUT:
+ FOUND = True
+ else:
+ print(ERROR_NOT_FOUND)
+
+PROGRAM() \ No newline at end of file