//
// ServoEaser2MovesList.ino -- show how to send ServoEaser a list of moves
//
// 2011, TeamPneumo, Tod E. Kurt, http://todbot.com/blog/
//
//
#include <Servo.h>
#include "ServoEaser.h"
const int ledPin = 13;
const int servoPin = 7;
int servoFrameMillis = 20; // minimum time between servo updates
Servo servo1;
ServoEaser servoEaser;
// configurable list of servo moves
int myServoMovesCount0 = 9;
ServoMove myServoMoves0[] = {
// angle, duration
{ 10, 1500},
{170, 1500},
{ 10, 1300},
{170, 1300},
{ 90, 2000},
{ 90, 2000}, // wait at 90
{135, 3000},
{ 45, 3000},
{135, 1000},
};
int myServoMovesCount1 = 7;
ServoMove myServoMoves1[] = {
// angle, duration
{ 90, 12000},
{ 85, 1000},
{ 95, 1000},
{ 80, 1000},
{ 100, 1000},
{ 70, 1000},
{ 110, 1000},
};
// pick which list you want here
int myServoMovesCount = myServoMovesCount0;
ServoMove* myServoMoves = myServoMoves0;
//
void setup()
{
Serial.begin(19200);
Serial.println("ServoEaser2MovesList");
// give pin, and min,max microseconds
servo1.attach( servoPin ); //, 700,2300 ); // maybe give min/max here too?
servoEaser.begin( servo1, servoFrameMillis );
servoEaser.setMinMaxMicroseconds(700,2300);
// start playing a moves list on a particular servo
servoEaser.play( myServoMoves, myServoMovesCount );
}
//
void loop()
{
servoEaser.update();
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
servo:GND
servo:V+
servo:PWM