ChandanShamala Library

Developing Communities                                                                          Be Good Do Good

Chandler 85248
chandan@chandanshamalalibrary.org

  • Home
  • About Us
  • Volunteering Opportunities
  • How You Can Help
  • AZ FLL Pictures
  • USA ChaptersClick to open the USA Chapters menu
    • BAY AREA - San Jose Chapter
    • Raspberry Pi classes
  • IndiaClick to open the India menu
    • Certificate of Registration
    • Memorandum of Association
    • India Home
    • Medical Camp
    • Blood Donors Group at Goalpara
  • STEM Videos from the Web
  • Mobile STEM/IOT/Robotics LaboratoryClick to open the Mobile STEM/IOT/Robotics Laboratory menu
    • DIY: Solar Energy System
  • Make your Own Phone
  • Makers - Lets Start!
  • Intel Edison ClassesClick to open the Intel Edison Classes menu
    • Intel Edison 101
    • Intel Edison 201
    • Intel Edison 301
  • Intel Edison ProjectsClick to open the Intel Edison Projects menu
    • Intel Edison Setup
    • BlinkWithoutDelay
    • Hello World with Grove LCD
    • Grove Light Sensor
    • Grove Moisture Sensor
    • Grove PIR Motion Sensor
    • Grove UV Sensor
    • Grove Servo Motor
    • GroveTemperature Sensor
    • Grove Sound Sensor
  • Arduino ino FilesClick to open the Arduino ino Files menu
    • light-sensor.ino
    • pirmotion-sensor.ino
    • moisture-sensor
    • hello-world.ino
    • uv-sensor.ino
    • servo-sweep.ino
    • temp-sensor.ino
    • sound-sensor.ino
  • STEM CoursesClick to open the STEM Courses menu
    • Simple Energy Source - Battery
    • SimpleMachines
    • STEAM 101
    • STEAM201
    • STEAM301
    • STEAM401
    • STEAM501
  • Sustainability Courses: Solar
  • Solar Light Circuit
  • Sensor 101
  • LEGO Classes
  • Drone Projects
  • 3D Printing Projects
  • Programming Resources
  • Contact Us
  • Contact BayArea Chapter
  • Bylaws
  • Thank You
  • Events Participated

servo-sweep.ino

// Sweep modified by chandan das

// by BARRAGAN <http://barraganstudio.com> 

// This example code is in the public domain.

#include <Servo.h>

  Servo myservo;  // create servo object to control a servo

                 // a maximum of eight servo objects can be created

    int pos = 0;    // variable to store the servo position

 void setup() {

   myservo.attach(5);  // attaches the servo on pin 5 to the servo object

 }

 void loop()

 {

    for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees

   {

              // in steps of 1 degree

              myservo.write(pos);

             // tell servo to go to position in variable 'pos'

             delay(300);                       // waits 300ms for the servo to reach the position

   }

   for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees

   {

             myservo.write(pos);              // tell servo to go to position in variable 'pos'

             delay(300);                       // waits 15ms for the servo to reach the position

   }

 } 



Copyright 2019 Chandan Shamala Library. All rights reserved.

Web Hosting by Yahoo!

Chandler 85248
chandan@chandanshamalalibrary.org