sleep(0.2) bezelie.moveRot(-10) sleep(0.4) bezelie.moveRot(0) bezeTalk("long") #subprocess.call('/home/pi/aquestalkpi/AquesTalkPi -s 120 "こんにちわー" | aplay', shell=True) sleep(0.5) bezelie.movePit(0, 1) sleep(0.2) # pygameで画像を表示 pygame_imshow(stream.array) # "q"を入力でアプリケーション終了 for e in pygame.event.get(): if e.type == pygame.KEYDOWN: if e.key == pygame.K_q: pygame.quit() sys.exit() # streamをリセット stream.seek(0) stream.truncate() # yawサーボを回す bezelie.moveYaw(yaw) sleep(0.2) yaw = yaw + delta if yaw > 15 or yaw < -15: delta = delta * -1
while (True): bezelie.movePit (30, 2) sleep (0.2) bezelie.movePit (-30, 1) sleep (0.2) bezelie.movePit (0) sleep (0.5) bezelie.moveRot (30, 1) sleep (0.2) bezelie.moveRot (-30, 1) sleep (0.2) bezelie.moveRot (0) sleep (0.5) bezelie.moveYaw (40) sleep (0.2) bezelie.moveYaw (-40) sleep (0.2) bezelie.moveYaw (0) sleep (0.5) except KeyboardInterrupt: print " Interrupted by Keyboard"
# Centering All Servos bezelie.centering() # Main Loop try: with picamera.PiCamera() as camera: camera.resolution = (800, 480) # Change this number for your display camera.rotation = 180 # comment out if your screen upside down camera.start_preview() time.sleep(0.2) pit = 0 while (True): bezelie.moveRot(-15) bezelie.moveYaw(-40, 2) sensorCheck() time.sleep(1) bezelie.moveRot(15) bezelie.moveYaw(40, 2) sensorCheck() time.sleep(1) pit += 10 if pit > 10: pit = -20 bezelie.movePit(pit) time.sleep(1) except KeyboardInterrupt: print " Interrupted by Keyboard"
def target(self): while not self.stop_event.is_set(): bezelie.moveRot(-10) bezelie.moveYaw(-40, 4) bezelie.moveRot(10) bezelie.moveYaw(40, 4)