long getArmIMEdegrees(unsigned char motorPort) { long encVal = GetIntegratedMotorEncoder(motorPort); return encVal * 360/627; }
/** * forward a joystick axis to a motor group and restrict by encoding * @param joystick the joystick number * @param channel the axis channel * @param group the initialized motor group * @param IME the pin of the motor with an IME * @param min the minimum encoding * @param max the maximum encoding **/ void JSToMotorGroupIME(int joystick, int channel, LV_MOTOR_GROUP *group, int IME, long min, long max) { long enc = GetIntegratedMotorEncoder(IME); setMotors(group, enc > min && enc < max ? getJSAnalog(joystick, channel) : 0); }
void DebugArm() { long l, r; l = GetIntegratedMotorEncoder(armL); r = GetIntegratedMotorEncoder(armR); PrintToScreen("arm encs: %ld, %ld\n", l, r); }
/** * forward a joystick axis to a motor and restrict by encoding * @param joystick the joystick number * @param channel the axis channel * @param motor the motor pin * @param inverse whether to invert the direction (1=Yes, 0=No) * @param min the minimum encoding value * @param max the maximum encoding value **/ void JSToMotorIME(int joystick, int channel, int motor, int inverse, long min, long max) { long enc = GetIntegratedMotorEncoder(motor); SetMotor(motor, enc > min && enc < max ? (getJSAnalog(joystick, channel) * (inverse == 1 ? -1 : 1)) : 0); }