-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJarvis.py
40 lines (29 loc) · 996 Bytes
/
Jarvis.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import time
import Basis.Commands as Command
from Basis.Communicate import VoiceAssistant
from Basis.Communication.Recognition import Recognition
from Basis.LEDs.pixels import LEDSteuerung
WAKEWORD = "jarvis"
class Jarvis(object):
def __init__(self):
self.pixels = LEDSteuerung()
self.VA = VoiceAssistant(self)
self.Recognition = Recognition()
self.sleepRoutine()
def sleepRoutine(self):
while(True):
recog = self.Recognition.recognize(type="Tensor")
if recog != None and WAKEWORD in recog:
self.pixels.wakeup()
break
self.recognizeRoutine()
def recognizeRoutine(self):
recog = self.Recognition.recognize(type="Google")
if recog == "":
self.pixels.sleep()
self.sleepRoutine()
elif recog != None:
Command.performCommand(self, recog)
self.sleepRoutine()
self.recognizeRoutine()
J = Jarvis()