달력

5

« 2026/5 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
2021. 3. 27. 20:41

가변저항으로 서보모터 제어 Arduino2021. 3. 27. 20:41

//10K ohm 가변저항을  이용하여 제어한다.

#include <Servo.h>

Servo myservo;

int pos, val;

void setup()

{

myservo.attach(8);

}

void loop()

{

val = analogRead(A0);

pos = map(val, 0, 1023, 0, 179);

myservo.write(pos); 

}

} //end

 

'Arduino' 카테고리의 다른 글

Preprocess  (0) 2021.03.27
int, const , #define  (0) 2021.03.27
스위치 선택에 따른 서보모터 제어  (0) 2021.03.27
한백 POKE C Pin Map  (0) 2020.07.29
내장 LED 점등하기  (0) 2020.07.28
:
Posted by gonlab