Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Jung Min Yean
- * Using the Servo Motor
- * Using the for loop
- * 04/16/19
- */
- #include <Servo.h> // the servo library (every time this is included, you must add an object
- const int servoPin = 3;
- Servo myservito;
- void setup()
- {
- myservito.attach(servoPin);
- Serial.begin(9600);
- }
- void loop()
- {
- for(int i = 0; i < 180; i++) // loop from 0 - 180
- { myservito.write(i);
- delay(10);
- }
- for(int i = 180; i > 0; i--) // loop from 180 - 0
- { myservito.write(i);
- delay(10);
- }
- }
RAW Paste Data