Project is a OWI 535 arm controlled by a "counterfeit" adafruit motor controller, connected to an Arduino Mega ADK, riding on top of a 4000 series Roomba and the user interface is a PS3 controller over a bluetooth connection to a cirago USB/BT adapter. Things are working and I have proper communication, but I am having a problem dealing with input from the PS3 controller.
Summary:
I'm working with a bluetooth PS3 controller and want to make use of pitch and roll to control specific motors of the OWI arm. I am encountering something strange. The PS3 controller likes to send data (it sends a lot), and it looks like somehow it's getting queued up, as a short twist on the controller causes 4-6 seconds of activation on the motor. Right now I am only testing with 1 motor.
The controller roll is going to turn on a motor for a short period of time, then turn it off. My idea was to do like the drive I am using for the Roomba so that continued moving of the controller will keep the motor moving.
So I'm thinking that somehow that input from the controller is getting queued up (or something similar enough to it) because there is lag on my trace output. For ~.1 sec movement of the controller, I get about 4 - 6 seconds of movement out of the motor. I don't think that's quite right.
Hopefully I'm doing something stupid and you can point that out real quick-like.
Video:
http://youtu.be/-yk-4GFu20gSnippet of the function I am working with / talking about (whole program attached due to size):
if(armMode){
if(PS3.getAngle(Roll) < 150){ // move motor 1 left
Serial.println(PS3.getAngle(Roll));
motor1.setSpeed(200); // set the speed to 100/255
motor1.run(FORWARD);
delay(250);
motor1.setSpeed(0);
} // end left
if(PS3.getAngle(Roll) > 200){ // move motor 2 right
Serial.println(PS3.getAngle(Roll));
motor1.setSpeed(200); // set the speed to 100/255
motor1.run(BACKWARD);
delay(250);
motor1.setSpeed(0);
} // end right
...