# File: test.py # Purpose: Test the robots before and after the semester # First import myro and connect to the robot from myro import * init() # Define the new functions... def testStall(): print "The following should be 0" print getStall() print "Hold me still as I try to move..." wait(3) motors(.3,.3) print "Now I should be a 1" wait(2) print getStall() stop() def testMotors(speed): print "move right wheel forwards" motors(speed,0) wait(3) print "move right wheel backwards" motors(-speed,0) wait(3) print "move left wheel forwards" motors(0,speed) wait(3) print "move left wheel backwards" motors(0,-speed) wait(3) stop() print "DONE!!" def testLights(): print "Testing bright:" wait(2) print getBright() print "Find something bright!!! (numbers should go down)" wait(1) print "Now the numbers are:" print getBright() print "Testing light: cover light sensors" wait(3) print getLight() print "Uncover!! (numbers should go down)" wait(3) print "Now the numbers are:" print getLight() print "Done! :)" def testIR(): print "Testing IR sensors..." print getIR() print "Put a book in front..." wait(3) print getIR() print "Testing getObstacle..." print getObstacle() print "Put the book in front again..." wait(3) print getObstacle() print "Doooooone!" def main(): print "Starting..." print getName() print "Sound Check" beep(0.25, 261.6) beep(0.25, 293.7) beep(0.25, 349.3) print "Sounds Good!" #senses() print getBattery() print "That should have been closer to 9 than 0" speak("Hello. I am a robot.") print "The current time is " print currentTime() askQuestion("Do you like ice cream?") askQuestion("Which is the random number?", [1, 2, 3, randomNumber()]) testStall() testLights() testIR() print "Say cheese!" wait(5) show(takePicture()) wait(3) show(takePicture("color")) wait(3) show(takePicture("gray")) wait(3) print "Done with the pictures" print "Not testing graphics abilities." print "Motors at full speed..." testMotors(1) print "Motors at half speed..." testMotors(0.5) print "Sensor window." senses() print "...Done"