import tensorflow as tf import tflearn from BreakfastSerial import Arduino, Servo from time import sleep from tflearn.layers.conv import conv_2d, max_pool_2d from tflearn.layers.core import input_data, dropout, fully_connected from tflearn.layers.estimator import regression import numpy as np from PIL import Image import cv2 import imutils # global variables bg = None board = Arduino("/dev/ttyACM0") servol = Servo(board, "8") servor = Servo(board, "9") servom = Servo(board, "10") servoi = Servo(board, "11") servot = Servo(board, "12") def resizeImage(imageName): basewidth = 100 img = Image.open(imageName) wpercent = (basewidth / float(img.size[0])) hsize = int((float(img.size[1]) * float(wpercent))) img = img.resize((basewidth, hsize), Image.ANTIALIAS) img.save(imageName)
import code code.InteractiveConsole(locals=globals()).interact() ########NEW FILE######## __FILENAME__ = servo #! /usr/bin/env python """ This is an example that demonstrates how to use a servo with BreakfastSerial. It assumes you have a servo wired up to pin 10. """ from BreakfastSerial import Arduino, Servo from time import sleep board = Arduino() servo = Servo(board, 10) servo.set_position(180) sleep(2) servo.move(-135) sleep(2) servo.center() sleep(2) servo.reset() # Run an interactive shell so you can play (not required) import code code.InteractiveConsole(locals=globals()).interact() ########NEW FILE########