Fabio Faria / Mbed 2 deprecated DEEC_STM32_for_Romi

Dependencies:   mbed

Committer:
fabiofaria
Date:
Thu Feb 21 00:36:53 2019 +0000
Revision:
1:1e85a02fe11a
Child:
2:eb9ed5a05c71
Robot library added.

Who changed what in which revision?

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