Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 6 months ago.
It's should be Left or Right?
Hello, when I use m3pi source code, I find these code that have made me dizzy.
void m3pi::left_motor (float speed) { motor(0,speed); }
void m3pi::right_motor (float speed) { motor(1,speed); }
0: left wheel 1: right wheel
but in the following code, 1 is M1(leftwheel), 0 is M2(rightwheel), WHY??? void m3pi::motor (int motor, float speed) { char opcode = 0x0; if (speed > 0.0) { if (motor==1) opcode = M1_FORWARD; else opcode = M2_FORWARD; } else { if (motor==1) opcode = M1_BACKWARD; else opcode = M2_BACKWARD; } unsigned char arg = 0x7f * abs(speed);
_ser.putc(opcode); _ser.putc(arg); }
THANK YOU!