#The following line is required for the Finch to work.
#Please replace the import line with the Finch's location.
import edu.cmu.ri.createlab.terk.robot.finch.Finch as Finch
def happyState():
# Set things up
tom=Finch()
# Continue executing the code below until "tom" is turned upside down.
while not tom.isFinchUpsideDown():
if tom.isShaken():
tom.setLED(red)
tom.saySomething("Stop shaking me")
#If Tom is being shaken his beak light should turn red,
#and he should say #Stop shaking me".
tom.sleep(3000)
elif tom.isBeakUp():
#If his beak is up Tom's light
#should turn yellow, and he should say "Please put my beak down".
tom.setLED(yellow)
tom.saySomething("Please put my beak down")
tom.sleep(3000)
else:
tom.setLED(green)
tom.saySomething("Now I'm happy")
#For any other state Tom's light should turn green and he should say
#"Now I'm happy".
tom.sleep(3000)
tom.quit()
#Please replace the import line with the Finch's location.
import edu.cmu.ri.createlab.terk.robot.finch.Finch as Finch
def happyState():
# Set things up
tom=Finch()
# Continue executing the code below until "tom" is turned upside down.
while not tom.isFinchUpsideDown():
if tom.isShaken():
tom.setLED(red)
tom.saySomething("Stop shaking me")
#If Tom is being shaken his beak light should turn red,
#and he should say #Stop shaking me".
tom.sleep(3000)
elif tom.isBeakUp():
#If his beak is up Tom's light
#should turn yellow, and he should say "Please put my beak down".
tom.setLED(yellow)
tom.saySomething("Please put my beak down")
tom.sleep(3000)
else:
tom.setLED(green)
tom.saySomething("Now I'm happy")
#For any other state Tom's light should turn green and he should say
#"Now I'm happy".
tom.sleep(3000)
tom.quit()
No comments:
Post a Comment