I am attempting to create a library that will help to control motors (continuous rotation servos) in conjunction with encoders to control distance. Lets say I call this "magicMotor()" I want to pass this the following
magicMotor(motorPortNumber, motorPowerLevel, distance, encoderPortNumber(s))
For those of you that have used Botball equipment I'm attempting to implement the "move relative position" or "mrp" command.
I can create this function but it would be blocking. Ideally I would want to be able to turn on multiple motors at a time. The following code would be used to turn on 2 motors to drive straight.
magicMotor(10, 255, 3000, 0); // Turn on motor port 10 full power, for 3000 tick from encoder on interrupt port 0 magicMotor(11, 255, 3000, 2); // Turn on motor port 11 full power, for 3000 tick from encoder on interrupt port 2
Any ideas? Is this even possible without multi-threading?