Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyttsx
- engine = pyttsx.init()
- engine.runAndWait()
- SteerDirection = 0 # neg/pos is Steer left/right in degrees
- EngineSpeed = 0 # neg/pos is forward/backward in Speed% 1-100
- CameraDollyLR = 0
- CameraDollyUD = 0
- SpeakOnce = 0
- SpeakLine = ''
- #incoming 'data' example
- data = "-45,25,0,15,1,Tralala"
- # Split up data into a list of integers and strings
- mList = [int(e) if e.isdigit() else e for e in data.split(',')]
- # Print full list for debug
- print (mList)
- # --------------------------------------------------------
- #print (mList[0])
- SteerDirection = (mList[0])
- print ('SteerDirection = ' + str(SteerDirection))
- #print (mList[1])
- EngineSpeed = (mList[1])
- print ('EngineSpeed = ' + str(EngineSpeed))
- #print (mList[2])
- CameraDollyLR = (mList[2])
- print ('CameraDollyLR = ' + str(CameraDollyLR))
- #print (mList[3])
- CameraDollyUD = (mList[3])
- print ('CameraDollyUD = ' + str(CameraDollyUD))
- #print (mList[4]) # Trigger speach send 1x
- #print (mList[5]) " Line to speak
- SpeakOnce = (mList[4])
- SpeakLine = (mList[5])
- if (SpeakOnce == 1):
- print ('SpeakLine = ' + SpeakLine)
- engine.say('The quick brown fox jumped over the lazy dog.')
- engine.runAndWait()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement