diff options
Diffstat (limited to 'bin')
| -rw-r--r-- | bin/icon.png | bin | 0 -> 3754 bytes | |||
| -rw-r--r-- | bin/kasper_gui.py | 10 | ||||
| -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 Binary files differnew file mode 100644 index 0000000..c372c49 --- /dev/null +++ b/bin/icon.png 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 |
