arduino program for servo motor

ARDUINO WITH SERVO MOTOR

TOOLS-
 1. arduino uno r3
 2. servo motor ( 0 degree to 180 degree rotation)
 3.jumping wires

CODES-

 #include<Servo.h>    // Header file for servo motor
Servo m ;                   //  defined name of servo motor as m.

void setup() {
  m.attach(9);             // attach the data wire of servo to arduino 9th pin
  }

void loop() {
  m.write(0);                //  servo motor will go to 0 degree
  delay(10);
  m.write(90);             //    servo motor will go to 90 degree
  delay(10);
  m.write(0);
  delay(10);
  m.write(180);           // servo motor will go to 180 degree
  delay(10);
  m.write(0);
  }



   link- https://github.com/debasishduttajrt1?tab=repositories


Comments

Popular posts from this blog

what do you think about IOT?

SESSION 1 (8051 MICRO-CONTROLLER)