최대 1 분 소요

https://dronesandrovs.wordpress.com/2012/11/24/how-to-control-a-brushless-motor-esc-with-arduino/

가변저항을 이용해 모터 제어 .

가변 저항 값을 A0에서 받고 모터 제어 신호는 D9에서 보내서 컨트롤 하는것으로 구현 됨.

image

image

#include <Servo.h>
 
Servo esc;
int throttlePin = 0;
 
void setup()
{
esc.attach(9);
Serial.begin(9600);
}
 
void loop()
{
int throttle = analogRead(throttlePin);
 
throttle = map(throttle, 0, 1023, 0, 179);
Serial.println(throttle);
esc.write(throttle);
}