Hello, I'm trying to control an RC electronic speed controller (ESC) from Processing on my Mac. ESCs use the same control signal as a regular RC servo, so I'd appreciate advice from anyone who has experience with either. If you're curious, a 0? servo signal to the ESC runs the motor in full reverse, 90? is stopped, and 180? is full forward.
I know my wiring is right, because I can control the motor from the servo mode slider in the Firmata Test application, and I can also use the "sweep" example code on the Arduino Servo library refpage to make the motor run back and forth without intervention from the computer.
In a nutshell, I need to control this ESC (or servo, however you like to think about it) in real-time from my Processing sketch. I know only one Processing command that helps towards this end, and that's "arduino.pinMode(escPin, Arduino.SERVO);", called in setup().
Anyone know what Processing syntax will actually set the servo to a certain angle?
I tried "arduino.analogWrite(escPin, speed);" inside of draw(), after executing the above command in setup(). "speed" was assigned various int values from 0-180, but the motor did not respond properly and did not reverse, suggesting that the PWM on the pin was still running @~390Hz rather than giving a proper RC pulse.
A rundown of the 'ware: Macbook Pro running Mac OS 10.6.7 and Processing 1.5.1 Arduino Mega 2560 running StandardFirmata 2.2 Turborix EL 110A ESC fed for now by a 250W ATX PSU and controlling a small 12V Johnson motor for bench tests