This is library provides a simplified interface to a SAMrI sumobot Installation -------------------------------------------------------------------------------- To install this library, just place this entire folder as a subfolder in your Arduino/libraries folder. When installed, this library should look like: Arduino/libraries/SAMrI (this library's folder) Arduino/libraries/SAMrI/SAMrI.cpp (the library implementation file) Arduino/libraries/SAMrI/SAMrI.h (the library description file) Arduino/libraries/SAMrI/keywords.txt (the syntax coloring file) Arduino/libraries/SAMrI/examples (the examples in the "open" menu) Arduino/libraries/SAMrI/readme.txt (this file) Building -------------------------------------------------------------------------------- After this library is installed, you just have to start the Arduino application. You may see a few warning messages as it's built. To use this library in a sketch, go to the Sketch | Import Library menu and select SAMrI. This will add a corresponding line to the top of your sketch: #include To stop using this library, delete that line from your sketch. Geeky information: After a successful build of this library, a new file named "SAMrI.o" will appear in "Arduino/libraries/SAMrI". This file is the built/compiled library code. If you choose to modify the code for this library (i.e. "SAMrI.cpp" or "SAMrI.h"), then you must first 'unbuild' this library by deleting the "SAMrI.o" file. The new "SAMrI.o" with your code will appear after the next press of "verify" Using -------------------------------------------------------------------------------- #include SAMrI «instance_name»(«gearing_configuration») - one of: - SAMrI::GEARING_12P7_1 - SAMrI::GEARING_38P2_1 - SAMrI::GEARING_114P7_1 - SAMrI::GEARING_344P2_1 init(); - run once in setup() MOTOR_PORTS left() MOTOR_PORTS right() - get a structure holding the ports configured to access the left and right motors - the results should not be modified. Only use them as an argument to pass to one of motor control methods that need information about which motor to access MOTOR_MODE forward(void); MOTOR_MODE reverse(void); MOTOR_MODE coast(void); MOTOR_MODE brake(void); - get a structure holding the values need to set hardware values for a specific motor function - the results should not be modified. Only use them as an argument to pass to the wheel_mode method - only needed when using the low level wheel_mode method void wheel_forward(const MOTOR_PORTS motor, const unsigned int speed); void wheel_reverse(const MOTOR_PORTS motor, const unsigned int speed); void wheel_brake(const MOTOR_PORTS motor, const unsigned int speed); - set one of the motors to the specified function, and set the speed void wheel_coast(const MOTOR_PORTS motor); - set one of the motor to coasting mode (no driving or braking power) void wheel_mode(const MOTOR_PORTS motor, const MOTOR_MODE mode); - lower level method to set a single motor the specified mode void motor_speed(const MOTOR_PORTS, const unsigned int); - set the pwm level (speed) for a single motor. This affects all modes except coast unsigned int get_left(void); unsigned int get_right(void); - get a reading from the specified sensor