Created
November 26, 2013 19:32
-
-
Save Mango-kid/7664660 to your computer and use it in GitHub Desktop.
This program will actuate a servo motor back and forth from 0 to 180 degrees
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This program will actuate a servo motor back and forth from 0 to 180 degrees | |
*/ | |
#include <Servo.h> | |
// define the servo object and the angle variable | |
Servo servo1; | |
int angle1 = 0; | |
void setup() { | |
servo1.attach(9); | |
} | |
void loop() { | |
// increment the servo through 180 degrees | |
for(angle1 = 0; angle1 < 180; angle1 += 1) { | |
// update the angle and wait a little | |
servo1.write(angle1); | |
delay(15); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment