I'm trying to connect an Arduino to an Electronic Speed Control and failing horribly. I'll explain what I've done so far, and then I'll explain the problem.
Before we get there, here's the list of parts I'm using:
Arduino Uno (genuine)
6V to 8.4V rated 18300 RPM 350 g-cm brushed motor.
Traxxas XL-5 brushed motor ESC. 1600 Hz is the highest PWM signal it accepts, if I'm not wrong.
Venom 4200mAh NiMH 8.4V battery pack (will replace soon with a 7.2V).
So I first connected the ESC to the motor. The connection is this bullet lead connection (the connection seems intact), and then the ESC to the Arduino. I connected the white wire to pin 9 and the black wire to ground. If I'm not wrong, this is the standard servo motor setup. I then plugged the Arduino into my computer, which has an intact USB port. Lastly, I connected the battery pack to the ESC.
Now I've tried to upload some basic code to try and calibrate my ESC, but it just plain our refuses to work. Under no circumstances will the motor run. The code I'm using just sends the signal sent by the signal monitor.
I'm a complete noob to Arduino, so I don't know what could be wrong. The program I have in mind needs to be able to run while not connected to the computer, activate when a push-button switch is activated, run the motor for a certain distance (which involves an encoder, right?), and then stop.
Any pointers or things I could be doing wrong?
int value = 0;
Servo myservo;
void setup() {
firstESC.attach(9); // attached to pin 9
Serial.begin(9600);
}
void loop() {
myservo.writeMicroseconds(value);
if(Serial.available())
value = Serial.parseInt(); // Parse an Integer from Serial
}
and the one here:
#include <Servo.h>
#define MAX_SIGNAL 2000
#define MIN_SIGNAL 700
#define MOTOR_PIN 9
Servo motor;
void setup() {
Serial.begin(9600);
Serial.println("Program begin...");
Serial.println("This program will calibrate the ESC.");
motor.attach(MOTOR_PIN);
Serial.println("Now writing maximum output.");
Serial.println("Turn on power source, then wait 2 seconds and press any key.");
motor.writeMicroseconds(MAX_SIGNAL);
// Wait for input
while (!Serial.available());
Serial.read();
// Send min output
Serial.println("Sending minimum output");
motor.writeMicroseconds(MIN_SIGNAL);
}
void loop() {
}
^shamelessly copied from the internet
Code
button in the editor to format code as code. Your current method did not look nice. :) – Avamander Mar 2 '16 at 16:58