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@2:eb9ed5a05c71, 2019-02-21 (annotated)
- Committer:
- fabiofaria
- Date:
- Thu Feb 21 00:41:43 2019 +0000
- Revision:
- 2:eb9ed5a05c71
- Parent:
- 1:1e85a02fe11a
Fixed doxygen documentation generation.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fabiofaria | 2:eb9ed5a05c71 | 1 | /** @file */ |
fabiofaria | 1:1e85a02fe11a | 2 | #ifndef ROBOT_H_ |
fabiofaria | 1:1e85a02fe11a | 3 | #define ROBOT_H_ |
fabiofaria | 1:1e85a02fe11a | 4 | |
fabiofaria | 1:1e85a02fe11a | 5 | #include "mbed.h" |
fabiofaria | 1:1e85a02fe11a | 6 | |
fabiofaria | 1:1e85a02fe11a | 7 | extern int16_t countsLeft; |
fabiofaria | 1:1e85a02fe11a | 8 | extern int16_t countsRight; |
fabiofaria | 1:1e85a02fe11a | 9 | |
fabiofaria | 1:1e85a02fe11a | 10 | /** \brief Sets the speed for both motors. |
fabiofaria | 1:1e85a02fe11a | 11 | * |
fabiofaria | 1:1e85a02fe11a | 12 | * \param leftSpeed A number from -300 to 300 representing the speed and |
fabiofaria | 1:1e85a02fe11a | 13 | * direction of the left motor. Values of -300 or less result in full speed |
fabiofaria | 1:1e85a02fe11a | 14 | * reverse, and values of 300 or more result in full speed forward. |
fabiofaria | 1:1e85a02fe11a | 15 | * \param rightSpeed A number from -300 to 300 representing the speed and |
fabiofaria | 1:1e85a02fe11a | 16 | * direction of the right motor. Values of -300 or less result in full speed |
fabiofaria | 1:1e85a02fe11a | 17 | * reverse, and values of 300 or more result in full speed forward. */ |
fabiofaria | 1:1e85a02fe11a | 18 | void setSpeeds(int16_t leftSpeed, int16_t rightSpeed); |
fabiofaria | 1:1e85a02fe11a | 19 | |
fabiofaria | 1:1e85a02fe11a | 20 | /** \brief Sets the speed for the left motor. |
fabiofaria | 1:1e85a02fe11a | 21 | * |
fabiofaria | 1:1e85a02fe11a | 22 | * \param speed A number from -300 to 300 representing the speed and |
fabiofaria | 1:1e85a02fe11a | 23 | * direction of the left motor. Values of -300 or less result in full speed |
fabiofaria | 1:1e85a02fe11a | 24 | * reverse, and values of 300 or more result in full speed forward. */ |
fabiofaria | 1:1e85a02fe11a | 25 | void setLeftSpeed(int16_t speed); |
fabiofaria | 1:1e85a02fe11a | 26 | |
fabiofaria | 1:1e85a02fe11a | 27 | /** \brief Sets the speed for the right motor. |
fabiofaria | 1:1e85a02fe11a | 28 | * |
fabiofaria | 1:1e85a02fe11a | 29 | * \param speed A number from -300 to 300 representing the speed and |
fabiofaria | 1:1e85a02fe11a | 30 | * direction of the right motor. Values of -300 or less result in full speed |
fabiofaria | 1:1e85a02fe11a | 31 | * reverse, and values of 300 or more result in full speed forward. */ |
fabiofaria | 1:1e85a02fe11a | 32 | void setRightSpeed(int16_t speed); |
fabiofaria | 1:1e85a02fe11a | 33 | |
fabiofaria | 1:1e85a02fe11a | 34 | /*! Returns the number of counts that have been detected from the both |
fabiofaria | 1:1e85a02fe11a | 35 | * encoders. These counts start at 0. Positive counts correspond to forward |
fabiofaria | 1:1e85a02fe11a | 36 | * movement of the wheel of the Romi, while negative counts correspond |
fabiofaria | 1:1e85a02fe11a | 37 | * to backwards movement. |
fabiofaria | 1:1e85a02fe11a | 38 | * |
fabiofaria | 1:1e85a02fe11a | 39 | * The count is returned as a signed 16-bit integer. When the count goes |
fabiofaria | 1:1e85a02fe11a | 40 | * over 32767, it will overflow down to -32768. When the count goes below |
fabiofaria | 1:1e85a02fe11a | 41 | * -32768, it will overflow up to 32767. */ |
fabiofaria | 1:1e85a02fe11a | 42 | void getCounts(); |
fabiofaria | 1:1e85a02fe11a | 43 | |
fabiofaria | 1:1e85a02fe11a | 44 | /*! This function is just like getCounts() except it also clears the |
fabiofaria | 1:1e85a02fe11a | 45 | * counts before returning. If you call this frequently enough, you will |
fabiofaria | 1:1e85a02fe11a | 46 | * not have to worry about the count overflowing. */ |
fabiofaria | 1:1e85a02fe11a | 47 | void getCountsAndReset(); |
fabiofaria | 1:1e85a02fe11a | 48 | |
fabiofaria | 1:1e85a02fe11a | 49 | #endif /* ROBOT_H_ */ |