Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Robot.h
00001 /** @file */ 00002 #ifndef ROBOT_H_ 00003 #define ROBOT_H_ 00004 00005 #include "mbed.h" 00006 00007 extern int16_t countsLeft; 00008 extern int16_t countsRight; 00009 00010 /** \brief Sets the speed for both motors. 00011 * 00012 * \param leftSpeed A number from -300 to 300 representing the speed and 00013 * direction of the left motor. Values of -300 or less result in full speed 00014 * reverse, and values of 300 or more result in full speed forward. 00015 * \param rightSpeed A number from -300 to 300 representing the speed and 00016 * direction of the right motor. Values of -300 or less result in full speed 00017 * reverse, and values of 300 or more result in full speed forward. */ 00018 void setSpeeds(int16_t leftSpeed, int16_t rightSpeed); 00019 00020 /** \brief Sets the speed for the left motor. 00021 * 00022 * \param speed A number from -300 to 300 representing the speed and 00023 * direction of the left motor. Values of -300 or less result in full speed 00024 * reverse, and values of 300 or more result in full speed forward. */ 00025 void setLeftSpeed(int16_t speed); 00026 00027 /** \brief Sets the speed for the right motor. 00028 * 00029 * \param speed A number from -300 to 300 representing the speed and 00030 * direction of the right motor. Values of -300 or less result in full speed 00031 * reverse, and values of 300 or more result in full speed forward. */ 00032 void setRightSpeed(int16_t speed); 00033 00034 /*! Returns the number of counts that have been detected from the both 00035 * encoders. These counts start at 0. Positive counts correspond to forward 00036 * movement of the wheel of the Romi, while negative counts correspond 00037 * to backwards movement. 00038 * 00039 * The count is returned as a signed 16-bit integer. When the count goes 00040 * over 32767, it will overflow down to -32768. When the count goes below 00041 * -32768, it will overflow up to 32767. */ 00042 void getCounts(); 00043 00044 /*! This function is just like getCounts() except it also clears the 00045 * counts before returning. If you call this frequently enough, you will 00046 * not have to worry about the count overflowing. */ 00047 void getCountsAndReset(); 00048 00049 #endif /* ROBOT_H_ */
Generated on Wed Jul 13 2022 18:10:25 by
