소스 코드 예시
#include <Servo.h>
Servo myServo;
void setup() {
myServo.attach(9);
}
void loop() {
myServo.write(0);
delay(1000);
myServo.write(90);
delay(1000);
myServo.write(180);
delay(1000);
}
소스 코드 예시
#include "Servo.h"
Servo servo;
int potPin = 0;
int servoPin = 3;
int potVal;
void setup() {
servo.attach(servoPin);
}
void loop() {
potVal = analogRead(potPin);
potVal = map(potVal, 0, 1023, 0, 180);
servo.write(potVal);
delay(15);
}
댓글 없음:
댓글 쓰기