Oo, so I would have to migrate HS3 to a Windows system to get it working??
Sent from my iPhone using Tapatalk
Sent from my iPhone using Tapatalk
If this is your first visit, be sure to check out the FAQ. You must register before you can post.
IMPORTANT: Your first post will be checked for appropriate content. This may take a bit of time.
import RPi.GPIO as GPIO import time import socket import os GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(16, GPIO.OUT) speakstr = "" port = 12345 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.bind(("", port)) print ">> UDP Listener Script Starting <<" GPIO.output(16, GPIO.HIGH) try: data, server = s.recvfrom(1024) print("-> Received Data: " + data) if data.find("!TTS-") <> -1: GPIO.output(16, GPIO.LOW) print("--> TTS To Speak") speakstr = data.replace("!TTS-","") os.system("pico2wave -w tmp.wav '" + speakstr + "'") os.system("aplay tmp.wav") print("---> TTS Spoken") GPIO.output(16, GPIO.HIGH) except KeyboardInterrupt: GPIO.output(16, GPIO.LOW) s.close() pass except: GPIO.output(16, GPIO.LOW) s.close() print("> ~ Exception:") pass
Comment