import jetduino
from jetduino_pins import *

start_pin = ARD_D2

print("attaching to servos.")
for servo in range(0,12):
    jetduino.servoAttach(start_pin + servo)
    time.sleep(.1)

while True:
    try:
        for angle in range(0,180):
            #print("    angle %d" % angle)
            for servo in range(0,12):
                jetduino.servoWrite(start_pin + servo, angle)

            time.sleep(0.05)

    except KeyboardInterrupt:
        print("Exiting loop")
        break
    except IOError:
        print ("Error")

print("detaching from servos.")
for servo in range(0,12):
    jetduino.servoDetach(start_pin + servo)
    time.sleep(.1)

OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
'''

import time
import jetduino
from jetduino_pins import *

servo_pin = ARD_D4

print("attaching to servo.")
jetduino.servoAttach(servo_pin)
time.sleep(.1)

print("Moving servo to angle 0.")
jetduino.servoWrite(servo_pin, 0)
time.sleep(0.3)

print("Reading servo angle.")
cur_angle = jetduino.servoRead(servo_pin)
print ("angle =", cur_angle)
time.sleep(1)

print("Moving servo to angle 180.")
jetduino.servoWrite(servo_pin, 180)
time.sleep(0.3)

print("Reading servo angle.")
cur_angle = jetduino.servoRead(servo_pin)
print ("angle =", cur_angle)
time.sleep(1)