Fixed:
/////////////////////////////////////////////////////////////////////////////////////
SOLUTION
I spent weeks trying to get this to work. it figures i get it to work as soon as i post to this forum. Sorry for the wasted forum post. For those interested, here is the solution
its embarrassingly simple. the taking input from the nunchuck interrupted the motors. So i only accept input once in a cycle, and then delay() to let the motors run.
void loop(){
//accept nunchuck input
wiiControl();
//control motors according to input
move();
//delay motors to give them time to move
delay(200); // this fixed it
}
End Solution
/////////////////////////////////////////////////////////////////
I have been stuck on this problem for a long time. I could really use some help.
I have a vehicle with 2 motors. (left tread/right tread) and I am using the arduino motor shield. Both the wii input, and the motors work as programmed. I have tested them thoroughly.
however, if i use the wii nunchuck to control the motors, the motors won't work as they do when just running by themselves.
for instance:
This will move backwards with no problem
void loop(){
moveBackwards();
}
However, when i do this, it recognizes that it should go backwards, but the motors behave strangely
void loop(){
nunchuck.update();
int DOWN[] = { 128, 34 };
int joyx = nunchuck.joy_x();
int joyy = nunchuck.joy_y();
int offset = 20;
if(abs(joyy - DOWN[1]) < offset && abs(joyx - DOWN[0]) < offset){
Serial.println("MOVING BACKWARD!");
moveBackward();
}
I have had similar problems using IR remote control. Is there a way i can use an input to control the motors? what do i need to do? Any help would be greatly appreciated.