This is another iteration of the previous assignment.  The robots come into action during the day, and sleep during the night.  So, shining some light on to a photo sensor makes them more active!  When the amount of light is reduced, they go to sleep!

#include <Servo.h> ;

// The wiring assignment.
#define SERVO_PIN 9
#define SENSORPIN 0

Servo servoSmall;
Servo servoBig;
Servo servoMed;

void setup()
{
// Initialize the serial UART at 9600 bits per second.
Serial.begin(9600);
// Initialize the Servo object to use the given pin for output.
servoSmall.attach(SERVO_PIN);
servoBig.attach(7);
servoMed.attach(5);
}

void loop()
{
int sensorPhoto = analogRead(SENSORPIN);
Serial.println(sensorPhoto);

int timeDelay = 100;
int smooth = 30 ;

int sweepA = map(sensorPhoto, 400,950,20,130);
int startA = 90 - sweepA /2;
int endA = 90 + sweepA / 2;

for (int i = startA; i &lt;= endA; i=i + smooth) {
servoSmall.write(i/4);
servoBig.write(i);
servoMed.write(i/2);
delay(timeDelay);
}
for (int i = endA; i &lt;= startA; i=i + smooth) {
servoSmall.write(i/4);
servoBig.write(i);
servoMed.write(i/2);
delay(timeDelay);
}
}