Introduction: Servo LED Button Blink

Hey there i hope you like my cool instructuble using servo motors LEDs and buttons using arduino feel free to comment

Step 1: What You'll Need

Arduino uno

Bread Board(s)

Jumper wires

power source


Servo motor



Step 2: Setup

You have all you're materials lets get started!

1. Use 2 of your jumper wires. One in a number pin (D0 - D13) and one in ground

2. put the other end of the wires into the bread board in the columns you want

3. The long leg of the LED you have will go into the ground (GND) column and the short on into the number column

4. The button: the button has 4 legs, 2 will go on one side of the bread board and two on the other.

5. Use 3 of your jumpers. one in GND on in 5V (5 volts) and one in an "A number pin" (A0 - A5)

6. Put the other end of the wires into the column of each of the legs of the button (besides the fourth)

7. Servo motor: The servo motor has 3 wires attached to it. A brown, yellow, and red all connected by pin slots at the end. The ground wire is brown, the red wire goes to "V IN" which is located next to the "A number pins" on the same side of the board, and the yellow wire goes to a "D number pin" (but specifically to pins 4, 5, or 6)

8. Note that the servo motor needs an external power source that can be plugged into the arduino (A picture of it is shown on the last step)

9. in this project I've done the above three times (excluding the motor) feel free to do it how ever many times you want

Step 3: Coding

#include <Servo.h>
int x = 8;
int y = 9;
int z = 10;
int led1 = 3;
int led2 = 4;
int led3 = 6;
int led4 = 13;
int led5 = 12;
int led6 = 11;
#include <Servo.h>
Servo myservo;  
int pos = 0;
void setup() {
  // put your setup code here, to run once:
    pinMode(z, INPUT);
    pinMode(x, INPUT);
    pinMode(y, INPUT);
    pinMode(led1, OUTPUT);
    pinMode(led2, OUTPUT);
    pinMode(led3, OUTPUT);
    pinMode(led4, OUTPUT);
    pinMode(led5, OUTPUT);
    pinMode(led6, OUTPUT);
void loop() {
  // put your main code here, to run repeatedly:
   if (digitalRead(x) == 1){
      digitalWrite(led1, HIGH);
    }else {
      digitalWrite(led1, LOW);
      if (digitalRead(y) == 1){
      digitalWrite(led2, HIGH);
    }else {
      digitalWrite(led2, LOW);
        if (digitalRead(z) == 1){
      digitalWrite(led3, HIGH);
    }else {
      digitalWrite(led3, LOW);
    if (digitalRead(z) == 1 && digitalRead(x)== 1 ){
      digitalWrite(led4, HIGH);
    }else if (digitalRead(z) == 1 && digitalRead(y)== 1){
      digitalWrite (led5, HIGH);
    }else if (digitalRead(x) == 1 && digitalRead(y)== 1){
      digitalWrite(led6, HIGH);
    } else { 
      digitalWrite(led4, LOW);
      digitalWrite(led5, LOW);
      digitalWrite(led6, LOW);
    if (digitalRead(x) == 1 && digitalRead(z) == 1 && digitalRead(y) == 1){
      for (pos = 0; pos <= 180; pos += 1) { 
  for (pos = 180; pos >= 0; pos -= 1) { 
}else {
  Serial.println("Servo is not spinning");

Step 4: Test and Finish

Hooray you've made it to the final step! all that's left to do is upload the code to the arduino and watch the magic happen.

LED Contest 2017

Participated in the
LED Contest 2017