Llibreria per fer servir un HC-06 o HC-05 en mode esclau. És compatible amb les llibreries RTOS de mbed.

Dependents:   projecte_v4_rtos ProjecteRobotFinal

Committer:
jcabello7
Date:
Tue Jan 19 14:43:51 2016 +0000
Revision:
5:92151b9067e4
Parent:
2:298c9cc5af48
- No deixa avan?ar al robot si hi ha un obstacle en la direcci? d'avan?ament.; - Canviat el port s?rie per un que si que funciona.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jcabello7 0:acddf8d6d0cb 1 #ifndef MBED_HC05_H
jcabello7 0:acddf8d6d0cb 2 #define MBED_HC05_H
jcabello7 0:acddf8d6d0cb 3
jcabello7 0:acddf8d6d0cb 4 #include "mbed.h"
jcabello7 0:acddf8d6d0cb 5
jcabello7 2:298c9cc5af48 6 #define longString 128
jcabello7 2:298c9cc5af48 7
jcabello7 0:acddf8d6d0cb 8 class Hc05 : public RawSerial {
jcabello7 0:acddf8d6d0cb 9 private:
jcabello7 2:298c9cc5af48 10 int mode, vel, ang, m1, m2, m3;
jcabello7 2:298c9cc5af48 11 float x, y;
jcabello7 0:acddf8d6d0cb 12 Timer timer;
jcabello7 2:298c9cc5af48 13
jcabello7 0:acddf8d6d0cb 14 public:
jcabello7 0:acddf8d6d0cb 15 Hc05(PinName tx, PinName rx);
jcabello7 0:acddf8d6d0cb 16 ~Hc05();
jcabello7 2:298c9cc5af48 17 char strLlegit[longString];
jcabello7 2:298c9cc5af48 18 char strM1[longString];
jcabello7 2:298c9cc5af48 19 char strM2[longString];
jcabello7 2:298c9cc5af48 20 char strM3[longString];
jcabello7 2:298c9cc5af48 21 char strPos[longString];
jcabello7 0:acddf8d6d0cb 22 void iniString();
jcabello7 0:acddf8d6d0cb 23 void enviaString(char* str);
jcabello7 0:acddf8d6d0cb 24 bool llegirString();
jcabello7 0:acddf8d6d0cb 25 void tractaString();
jcabello7 0:acddf8d6d0cb 26 int getMode();
jcabello7 0:acddf8d6d0cb 27 int getVel();
jcabello7 0:acddf8d6d0cb 28 int getAng();
jcabello7 0:acddf8d6d0cb 29 void getStringLlegit(char* str);
jcabello7 0:acddf8d6d0cb 30 void comprovaConnexio();
jcabello7 0:acddf8d6d0cb 31 int getTimer();
jcabello7 1:cd73654d13ed 32 //Calculs
jcabello7 5:92151b9067e4 33 void calculaMotors(float S1, float S2, float S3);
jcabello7 1:cd73654d13ed 34 float getM1();
jcabello7 1:cd73654d13ed 35 float getM2();
jcabello7 1:cd73654d13ed 36 float getM3();
jcabello7 1:cd73654d13ed 37 float getX();
jcabello7 1:cd73654d13ed 38 float getY();
jcabello7 2:298c9cc5af48 39 void getStringM1(char* str);
jcabello7 2:298c9cc5af48 40 void getStringM2(char* str);
jcabello7 2:298c9cc5af48 41 void getStringM3(char* str);
jcabello7 0:acddf8d6d0cb 42 };
jcabello7 0:acddf8d6d0cb 43
jcabello7 0:acddf8d6d0cb 44 #endif