So I have a while loop running that does the following:
while ()
Ask Question
Prompt for Answer
Answer Entered:
motor.sendByte(0x80); //prefix
motor.sendByte(0x00); //activate motor controller
motor.sendByte(0x02); //motor 2 reverse .. 0|000010|0
motor.sendByte(0x5A); //speed @ 90
CPU.delay(20000); // WAIT 2 SECOND
motor.sendByte(0x80); //prefix
motor.sendByte(0x00); //activate motor controller
motor.sendByte(0x02); //motor 2 reverse .. 0|000010|0
motor.sendByte(0x00); //speed @ 0
CPU.delay(1000); // WAIT 100ms
Ask Question 2
Prompt for Answer 2
Answer 2 Entered:
motor.sendByte(0x80); //prefix
motor.sendByte(0x00); //activate motor controller
motor.sendByte(0x05); //motor 2 forward.. 0|000010|1
motor.sendByte(0x5A); //speed @ 90
CPU.delay(20000); // WAIT 2 SECOND
motor.sendByte(0x80); //prefix
motor.sendByte(0x00); //activate motor controller
motor.sendByte(0x05); //motor 2 forward.. 0|000010|1
motor.sendByte(0x00); //speed @ 0
CPU.delay(1000); // WAIT 100ms
End While
My problem is this: The first part spins the motor no problems, but the second part doesn’t move the motor at all, even though it should spin in the opposite direction just like the first part.
Once the second part “runs”, and it goes back to the first part, the motor spins again.
It seems like the controller gets the code to go reverse, then ignores the code to go forward.
Here your binary representation matches the hex and requests that motor number 2 move forward. If commands to motor 1 move the desired motor and commands to motor 2 have no effect, you should change this second command to:
I’m pretty sure I burnt some chips out though now.
I have 3 controllers hooked up through though the same pin and each controller has its own number.
They all used to work fine, but then I attempted to program a fourth controller and I think it messed up everything. Now only the first controller works and the rest of them don’t.
Is there some way to tell if they are still functioning correctly or if they are dead?
Ok so, I got them all working again, I mistakenly reprogrammed them, but now they work.
Back to the original problem, So it still doesn’t switch directions properly.
It will move in “reverse” at the speed it needs to, but then when switching direction to “forward”, it will move for a half second, just kinda sputters … but then when moving back to the “reverse” direction, it will move normally.
Can you try a lighter load? Perhaps your motor draws more power in one direction, or one direction of the motor driver is slightly better than the other. It would also be interesting to know what happens when you swap the leads on your motor. Also, what motor are you using?