Home » BLOG » MRPi1 Raspberry Pi robot – Speech synthesis

MRPi1 Raspberry Pi robot – Speech synthesis

  • Speech synthesis
  • Autonomous robot
  • Python program

The python program :


from mrpi1_lib import *
import time

#main program

state = 1

try:
  # infinite loop
  while 1:

    if state == 2:
      play("Thank you bye")# speech synthetis
      state = 3
    # read sensors
    p3 = proxSensor(3) 
    p4 = proxSensor(4)

    forward(30)
    print "%d %d" %(p3, p4)

    if (p3 > 900 or p4 > 900):
     stop() # stop robot
     state = 2
     playWav("BeCarefull.wav") # play wav file
     
     
except:
  stop()
  exit()