WeDo Python Alligator Program
From wikidb
Up
Python Alligator Program
# Alligator program for WeDo # Ed C. EPP # 5-12-13 # Intialize from wedo import WeDo wd = WeDo() import time # Open gator's mouth wd.motor_a = 50 time.sleep(1) wd.motor_a = 0 # Forever while True: # Close the gator's mouth if object detected if wd.distance < 0.08: wd.motor_a = -100 time.sleep(1) wd.motor_a = 50 time.sleep(1) wd.motor_a = 0 time.sleep(1) # Never executed wd.motor_a = 0