Documents » Pololu AVR Library Command Reference »7. Orangutan Motor ControlThe OrangutanMotors class and the C functions in this section allow PWM speed control of the two motor channels on the Orangutan boards and the 3pi robot. The motor control functions rely on PWM outputs from Timer0 and Timer2, so they will conflict with other code using these timers. Unfortunately the Arduino environment relies on Timer0 for its millis() and delay() functions, but this library enables a Timer2 interrupt that restores the functionality of millis() and delay() to normal. This interrupt is not included in the C and C++ versions of the library. For a higher level overview of this library and example programs that show how this library can be used, please see Section 5.e of the guide to Programming Orangutans from the Arduino Environment or Section 6.g of the Pololu AVR C/C++ Library User’s Guide. ReferenceC++ and Arduino methods are shown in red. C functions are shown in green. static void OrangutanMotors::setM1Speed(int speed) void set_m1_speed(int speed) This method will set the speed and direction of motor 1. Speed is a value between -255 and +255. The sign of speed determines the direction of the motor and the magnitude determines the speed. speed = 0 results in full brake while speed = 255 or -255 results in maximum speed forward or backward. If a speed greater than 255 is supplied, the motor speed will be set to 255. If a speed less than -255 is supplied, the motor speed will be set to -255. static void OrangutanMotors::setM2Speed(int speed) void set_m2_speed(int speed) This method will set the speed and direction of motor 2. static void OrangutanMotors::setSpeeds(int m1Speed, int m2Speed) void set_motors(int m1, int m2) This method will set the speeds and directions of motors 1 and 2. |
|
Home
|
Contact
|
About
|
Forum
|
US toll free: 1-877-7-POLOLU |