Motion motion

// Adafruit Motor shield library

// copyright Adafruit Industries LLC, 2009
// modified by Hana Kim / Shana Kim, 2011
#include <Servo.h>

// DC hobby servo
Servo servo2;
// DC hobby servo
Servo servo1;
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println(“Motor party!”);

// turn on servo
servo2.attach(10);
servo1.attach(9);}

int i;

// Test both servos ALL AT ONCE!
void loop() {
//motor.run(FORWARD);
for (i=0; i<255; i++) {
servo1.write(i);
servo2.write(i);
//motor.setSpeed(i);
//stepper.step(1, FORWARD, INTERLEAVE);
delay(3);}

for (i=255; i!=0; i–) {
servo1.write(i-255);
servo2.write(i-255);
//motor.setSpeed(i);
//stepper.step(1, BACKWARD, INTERLEAVE);
delay(3);}

//motor.run(BACKWARD);
for (i=0; i<255; i++) {
servo1.write(i);
servo2.write(i-255);
//motor.setSpeed(i);
delay(3);
//stepper.step(1, FORWARD, DOUBLE);}

for (i=255; i!=0; i–) {
servo1.write(i-255);
servo2.write(i-255);
//motor.setSpeed(i);
//stepper.step(1, BACKWARD, DOUBLE);
delay(3);}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: