Creative solution
Published

Servo Motor

Project using for Arduino beginners.

BeginnerFull instructions provided5,227
Servo Motor

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Jumper wires (generic)
Jumper wires (generic)
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

servo motor connect

Code

servo motor code

Arduino
#include <Servo.h> // include library

Servo Creativesolution; // identity object
void setup() {
  // put your setup code here, to run once:
Creativesolution.attach(9); 
}

void loop() {
  // put your main code here, to run repeatedly:

 Creativesolution.write(0);
 delay(1000);
Creativesolution.write(90);
delay(1000);
Creativesolution.write(180);
delay(1000);
Creativesolution.write(90);
delay(1000);

}

servo motor code 02

Arduino
#include <Servo.h> // include library

Servo Creativesolution; // identity object
void setup() {
  // put your setup code here, to run once:
Creativesolution.attach(9); 
}

void loop() {
  // put your main code here, to run repeatedly:

 for (int i=0; i<=180; i++){
  Creativesolution.write(i);
  delay(20);
 }
 for (int j=180; j>=0; j--){
  Creativesolution.write(j);
  delay(20);
 }
}

Credits

Creative solution

Creative solution

7 projects • 5 followers

Comments