Arduino motor shield + wii nunchuck don't work at same time (FIXED)


fixed:

/////////////////////////////////////////////////////////////////////////////////////
solution

i spent weeks trying work. figures work post forum. sorry wasted forum post. interested, here solution

its embarrassingly simple. taking input nunchuck interrupted motors. accept input once in cycle, , delay() let motors run.
code: [select]
void loop(){
   //accept nunchuck input
   wiicontrol();

   //control motors according input
   move();

  //delay motors give them time move
   delay(200); // fixed it

}


end solution
/////////////////////////////////////////////////////////////////






i have been stuck on problem long time. use help.

i have vehicle 2 motors. (left tread/right tread) , using arduino motor shield. both wii input, , motors work programmed. have tested them thoroughly.

however, if use wii nunchuck control motors, motors won't work when running themselves.

for instance:

this move backwards no problem

code: [select]
void loop(){

   movebackwards();

}



however, when this, recognizes should go backwards, motors behave strangely
code: [select]


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. there way can use input control motors? need do?  be appreciated.



Arduino Forum > Using Arduino > Motors, Mechanics, and Power (Moderator: fabioc84) > Arduino motor shield + wii nunchuck don't work at same time (FIXED)


arduino

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62