Modify code +- limits for pwm sweep
This commit is contained in:
parent
c2439c8fa1
commit
75cb115330
|
@ -16,9 +16,7 @@ int pos = 0; // variable to store the servo position
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
myservo.attach(9); // attaches the servo on pin 9 to the servo object
|
myservo.attach(9); // attaches the servo on pin 9 to the servo object
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
for (pos = 70; pos <= 130; pos += 1) { // goes from 0 degrees to 180 degrees
|
for (pos = 70; pos <= 130; pos += 1) { // goes from 0 degrees to 180 degrees
|
||||||
// in steps of 1 degree
|
// in steps of 1 degree
|
||||||
myservo.write(pos); // tell servo to go to position in variable 'pos'
|
myservo.write(pos); // tell servo to go to position in variable 'pos'
|
||||||
|
@ -29,3 +27,7 @@ void loop() {
|
||||||
delay(15); // waits 15ms for the servo to reach the position
|
delay(15); // waits 15ms for the servo to reach the position
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
delay(1000);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue