/** * Set motor speeds * \param left_motor left motor speed ranging from 0 to 1023. Sign indicates rotation direction * \param right_motor right motor speed ranging from 0 to 1023. Sign indicates rotation direction */ void HAL_set_motors(int16_t left_motor, int16_t right_motor) { /// right motor and left motor values must be between -1023 and 1023. No sanity checks so far if (right_motor < 0) { right_motor = -right_motor; RightMotorBackward(); } else RightMotorForward(); if (left_motor < 0) { left_motor = -left_motor; LeftMotorBackward(); } else LeftMotorForward(); LPC_TMR16B0->MR0 = 0x3ff - left_motor; LPC_TMR16B1->MR0 = 0x3ff - right_motor; }
void TurnRight(){ RightMotorBackward(); LeftMotorForward(); }
void MoveBack(){ RightMotorBackward(); LeftMotorForward(); }