Sure can
the first one I used for timed eye blinks is altered from the servo example "sweep"/* Sweep
by BARRAGAN <http://barraganstudio.com>
This example code is in the public domain.
modified 8 Nov 2013
by Scott Fitzgerald
arduino.cc/en/Tutorial/Sweep*/
#include <Servo.h>
Servo servo5; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup()
{
servo5.attach(11); // attaches the servo on pin 9 to the servo object
}
void loop()
{
for(pos = 0; pos <= 180; pos += 5) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=0; pos-=5) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(5000); // waits 15ms for the servo to reach the position
}
The second one I used for the sensors is altered from your "Make your awesome costumes more awesome!" instructable /*
* Example 5a
* Servo Control6
* This example uses 6 servos and analog inputs to move the servos according to the sensor input values
* Honus 2010
*/
#include <Servo.h> // include the servo library
Servo servoMotor1; // creates an instance of the servo object to control a servo
Servo servoMotor2;
Servo servoMotor3;
Servo servoMotor4;
int analogPin1 = 0; // the analog pin that the sensor is on
int analogPin2 = 1;
int analogPin3 = 2;
int analogPin4 = 3;
int analogValue1 = 0; // the value returned from the analog sensor
int analogValue2 = 0;
int analogValue3 = 0;
int analogValue4 = 0;
int servoPin1 = 5; // Control pin for servo motor
int servoPin2 = 6;
int servoPin3 = 9;
int servoPin4 = 10;
void setup() {
servoMotor1.attach(5); // attaches the servo on pin 4 to the servo object
servoMotor2.attach(6); // attaches the servo on pin 5 to the servo object
servoMotor3.attach(9); // attaches the servo on pin 6 to the servo object
servoMotor4.attach(10); // attaches the servo on pin 7 to the servo object
}
void loop()
{
analogValue1 = analogRead(analogPin1); // read the analog input (value between 0 and 1023)
analogValue1 = map(analogValue1, 0, 1023, 0, 179); // map the analog value (0 - 1023) to the angle of the servo (0 - 179)
servoMotor1.write(analogValue1); // write the new mapped analog value to set the position of the servo
analogValue2 = analogRead(analogPin2);
analogValue2 = map(analogValue2, 0, 1023, 0, 179);
servoMotor2.write(analogValue2);
analogValue3 = analogRead(analogPin3);
analogValue3 = map(analogValue3, 0, 1023, 0, 179);
servoMotor3.write(analogValue3);
analogValue4 = analogRead(analogPin4);
analogValue4 = map(analogValue4, 0, 1023, 0, 179);
servoMotor4.write(analogValue4);
delay(15); // waits for the servo to get there
}
Thanks for your help!