pepe

Dependencies:   mbed Matrix

Committer:
FJMS
Date:
Sun Nov 24 18:37:46 2019 +0000
Revision:
2:06b7789c7da0
Parent:
1:2716ea33958b
pepe;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
PedroMartins96 0:a7324f51348d 1 /** @file */
PedroMartins96 0:a7324f51348d 2 #ifndef ROBOT_H_
PedroMartins96 0:a7324f51348d 3 #define ROBOT_H_
PedroMartins96 0:a7324f51348d 4
PedroMartins96 0:a7324f51348d 5 #include "mbed.h"
PedroMartins96 0:a7324f51348d 6
PedroMartins96 0:a7324f51348d 7 extern int16_t countsLeft;
PedroMartins96 0:a7324f51348d 8 extern int16_t countsRight;
PedroMartins96 0:a7324f51348d 9 extern float De,Dd,T,pi,L,r,x,y,teta;
PedroMartins96 0:a7324f51348d 10
PedroMartins96 0:a7324f51348d 11 /** \brief Sets the speed for both motors.
PedroMartins96 0:a7324f51348d 12 *
PedroMartins96 0:a7324f51348d 13 * \param leftSpeed A number from -300 to 300 representing the speed and
PedroMartins96 0:a7324f51348d 14 * direction of the left motor. Values of -300 or less result in full speed
PedroMartins96 0:a7324f51348d 15 * reverse, and values of 300 or more result in full speed forward.
PedroMartins96 0:a7324f51348d 16 * \param rightSpeed A number from -300 to 300 representing the speed and
PedroMartins96 0:a7324f51348d 17 * direction of the right motor. Values of -300 or less result in full speed
PedroMartins96 0:a7324f51348d 18 * reverse, and values of 300 or more result in full speed forward. */
PedroMartins96 0:a7324f51348d 19 void setSpeeds(int16_t leftSpeed, int16_t rightSpeed);
PedroMartins96 0:a7324f51348d 20
PedroMartins96 0:a7324f51348d 21 /** \brief Sets the speed for the left motor.
PedroMartins96 0:a7324f51348d 22 *
PedroMartins96 0:a7324f51348d 23 * \param speed A number from -300 to 300 representing the speed and
PedroMartins96 0:a7324f51348d 24 * direction of the left motor. Values of -300 or less result in full speed
PedroMartins96 0:a7324f51348d 25 * reverse, and values of 300 or more result in full speed forward. */
PedroMartins96 0:a7324f51348d 26 void setLeftSpeed(int16_t speed);
PedroMartins96 0:a7324f51348d 27
PedroMartins96 0:a7324f51348d 28 /** \brief Sets the speed for the right motor.
PedroMartins96 0:a7324f51348d 29 *
PedroMartins96 0:a7324f51348d 30 * \param speed A number from -300 to 300 representing the speed and
PedroMartins96 0:a7324f51348d 31 * direction of the right motor. Values of -300 or less result in full speed
PedroMartins96 0:a7324f51348d 32 * reverse, and values of 300 or more result in full speed forward. */
PedroMartins96 0:a7324f51348d 33 void setRightSpeed(int16_t speed);
PedroMartins96 0:a7324f51348d 34
PedroMartins96 0:a7324f51348d 35 /*! Returns the number of counts that have been detected from the both
PedroMartins96 0:a7324f51348d 36 * encoders. These counts start at 0. Positive counts correspond to forward
PedroMartins96 0:a7324f51348d 37 * movement of the wheel of the Romi, while negative counts correspond
PedroMartins96 0:a7324f51348d 38 * to backwards movement.
PedroMartins96 0:a7324f51348d 39 *
PedroMartins96 0:a7324f51348d 40 * The count is returned as a signed 16-bit integer. When the count goes
PedroMartins96 0:a7324f51348d 41 * over 32767, it will overflow down to -32768. When the count goes below
PedroMartins96 0:a7324f51348d 42 * -32768, it will overflow up to 32767. */
PedroMartins96 0:a7324f51348d 43 void getCounts();
PedroMartins96 0:a7324f51348d 44
PedroMartins96 0:a7324f51348d 45 /*! This function is just like getCounts() except it also clears the
PedroMartins96 0:a7324f51348d 46 * counts before returning. If you call this frequently enough, you will
PedroMartins96 0:a7324f51348d 47 * not have to worry about the count overflowing. */
PedroMartins96 0:a7324f51348d 48 void getCountsAndReset();
PedroMartins96 0:a7324f51348d 49
PedroMartins96 0:a7324f51348d 50 void motion();
PedroMartins96 0:a7324f51348d 51
PedroMartins96 0:a7324f51348d 52 void pressed();
PedroMartins96 0:a7324f51348d 53
PedroMartins96 1:2716ea33958b 54 void mapa(int x3,int y3);
PedroMartins96 1:2716ea33958b 55
PedroMartins96 1:2716ea33958b 56 void cria_obj(int c, int l, int p[]);
PedroMartins96 1:2716ea33958b 57
PedroMartins96 1:2716ea33958b 58 void f_repulsiva();
PedroMartins96 0:a7324f51348d 59
PedroMartins96 1:2716ea33958b 60 void f_atrativa();
PedroMartins96 1:2716ea33958b 61
PedroMartins96 1:2716ea33958b 62 void print_map(int x3, int y3);
PedroMartins96 1:2716ea33958b 63
PedroMartins96 1:2716ea33958b 64 void VFF();
PedroMartins96 0:a7324f51348d 65
PedroMartins96 0:a7324f51348d 66 #endif /* ROBOT_H_ */