I have a basic question regarding the coding to use ESC's for motor speed control in Arduino UNO.
I have done some reading up and been scouring the web and the forums trying to find something that will help me solve my problems but I can't get my head around the issue.
What I am trying to do is to control the motor speed using a potentiometer. Ive connected a motor (MEDUSA 4300kv) to an ESC (picture attached) the ESC is connected to a regular 9V battery for power supply, the other end is connected to the Arduino ground (black wire from ESC) and a PWM pin for signal output (white wire from the ESC). NOTE I didnt know what to do with the red wire and from my understanding I didnt really need to connect it to the board. I used the following code which I got from the Arduino.cc example pages (the potentiometer is connected to A0 port, Ground, Arduino 5V pin):
// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>
Servo myservo; // create servo object to control a servo
int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin
myservo.attach(9); // attaches the servo on pin 9 to the servo object
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
The problem is that the motor doesn't go at full capacity or even close, I know this because it (motor and ESC) has been tested using a different control board that was controlled using a R/C transmitter-receiver set up with a variable power supply as source.
so basically: Help?