ARDUINO 3
Mon Jan 08 2024 23:12:49 GMT+0000 (Coordinated Universal Time)
Saved by
@马丽
#include <Servo.h>
Servo Serv1; //create a servo object named Serv1
//use a PWM pin (3,5,6,9,10,11)
int pinServo1=8;
void setup(){
Serv1.attach(pinServo1);
}
void loop(){
//move the servo 20 degrees
Serv1.write(20);
//allow enough time to move
delay(1000);
//move the servo 100 degrees
Serv1.write(100);
//allow enough time to move
delay(1000);
}
content_copyCOPY
Comments