서보모터

BABY CAT·2023년 7월 17일
0

Arduino

목록 보기
23/28

갈색선 gnd

빨간선 vcc

노란선 servo-pin

서보모터 지속 가동

#include <Servo.h>



int servoPin = 8;

Servo servo;

int angle =0;



void setup() {

 // put your setup code here, to run once:

 servo.attach(servoPin);

 servo.write(0);

}



void loop() {

 // put your main code here, to run repeatedly:

 for(angle= 0; angle<=180;angle++){

  servo.write(angle);

  delay(15);

 }

 for(angle=180; angle>=0; angle--){

  servo.write(angle);

  delay(15);

 }

}

1개의 댓글

comment-user-thumbnail
2023년 7월 18일

글 잘 봤습니다, 많은 도움이 되었습니다.

답글 달기