Servo

Parts Used

  • 6 Jumper wires

  • 1 Servo Motor

  • Tapes

  • 2 glowing sticks

Time Spent

Approximately 20 minutes

Issue

  • The servo spins continuesly when I looped servo.write(i) \(\forall i \in [1,5]\). It is supposed to stop at 5 degree.

The code

#include <Servo.h>

int servoPin = 3;

Servo servo;

int angle = 0;   // servo position in degrees

void setup()
{
    servo.attach(servoPin);
}

void loop()
{
    for(angle = 0; angle <= 180; angle+=30)
    {
        servo.write(angle);
        delay(2500);
    }

}

Results

I taped 2 glowing sticks on the servo and then took a picture while it is spinning.

The purpose of the code is to make the servo stop at specific angles to simulate a clock. Unfortunately, due to the unstability of the servo, it didn’t go well as planned. But I would still say it is a pretty nice photo.