-
Notifications
You must be signed in to change notification settings - Fork 1
/
textInput.py
28 lines (16 loc) · 853 Bytes
/
textInput.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
# Backup program for allowing to control combee via typed commands incase audio goes down
import pika # needed to send messages out via RabbitMQ
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
channel.queue_declare(queue='userOutput')
channel.queue_declare(queue='audioInput')
print("Running text input script. Type out commands as if they had been parsed by audio. ")
while True:
try:
userText = input("\nEnter what you want to say to the robot: \n")
channel.basic_publish(exchange='', routing_key='userOutput', body=userText)
#channel.basic_publish(exchange='', routing_key='audioInput', body=userText)
except KeyboardInterrupt:
print("\nInterrupt detected, closing down")
connection.close() # close RabbitMQ socket
break