Created
October 18, 2017 21:05
-
-
Save firatpayalan/bc94b4aa1e6ef1b9a3f6c10f7cdd2ab3 to your computer and use it in GitHub Desktop.
initializes sg90 9g micro servo motor on arduino device.
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
#include<Servo.h> | |
Servo servo; | |
int pos = 0; | |
int CLOSED_POSITION = 90; | |
int OPEN_POSITION = 0; | |
int MILISECOND = 1000; | |
void setup() { | |
servo.attach(0); | |
} | |
void loop() { | |
servo.write(CLOSED_POSITION); | |
delay(MILISECOND*5); //PULSE PERIOD | |
servo.write(OPEN_POSITION); | |
delay(1000); // HOLD PERIOD | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment