Created
August 25, 2016 19:30
-
-
Save ulitiy/5c319f65c419dfa1af7ca2dcdebab3ce to your computer and use it in GitHub Desktop.
This file contains 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 myservo; | |
const int servoPin = 9; | |
const int buttonPin = 12; | |
const int ledPin = 13; | |
void setup() { | |
myservo.attach(servoPin); | |
pinMode(buttonPin, INPUT); | |
digitalWrite(buttonPin, HIGH); | |
pinMode(ledPin, OUTPUT); | |
digitalWrite(ledPin, LOW); | |
myservo.write(180); | |
delay(1000); | |
myservo.detach(); | |
} | |
void loop() { | |
int buttonVal = digitalRead(buttonPin); | |
if(buttonVal == LOW) { | |
myservo.attach(servoPin); | |
myservo.write(30); | |
delay(575); | |
myservo.write(180); | |
delay(1500); | |
myservo.detach(); | |
delay(5000); | |
} | |
delay(13); | |
} |
that code is suit for sg90 servo?
Yes but it's weak.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
that code is suit for sg90 servo?