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
Hc05.h@0:acddf8d6d0cb, 2015-12-18 (annotated)
- Committer:
- jcabello7
- Date:
- Fri Dec 18 17:13:25 2015 +0000
- Revision:
- 0:acddf8d6d0cb
- Child:
- 1:cd73654d13ed
Versi? inicial
Who changed what in which revision?
User | Revision | Line number | New 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 | 0:acddf8d6d0cb | 6 | #define longString 128 //Longitud màxima del string a enviar |
jcabello7 | 0:acddf8d6d0cb | 7 | |
jcabello7 | 0:acddf8d6d0cb | 8 | class Hc05 : public RawSerial { |
jcabello7 | 0:acddf8d6d0cb | 9 | private: |
jcabello7 | 0:acddf8d6d0cb | 10 | int mode, vel, ang; |
jcabello7 | 0:acddf8d6d0cb | 11 | Timer timer; |
jcabello7 | 0:acddf8d6d0cb | 12 | char strLlegit[longString]; |
jcabello7 | 0:acddf8d6d0cb | 13 | public: |
jcabello7 | 0:acddf8d6d0cb | 14 | Hc05(PinName tx, PinName rx); |
jcabello7 | 0:acddf8d6d0cb | 15 | ~Hc05(); |
jcabello7 | 0:acddf8d6d0cb | 16 | void iniString(); |
jcabello7 | 0:acddf8d6d0cb | 17 | void enviaString(char* str); |
jcabello7 | 0:acddf8d6d0cb | 18 | bool llegirString(); |
jcabello7 | 0:acddf8d6d0cb | 19 | void tractaString(); |
jcabello7 | 0:acddf8d6d0cb | 20 | int getMode(); |
jcabello7 | 0:acddf8d6d0cb | 21 | int getVel(); |
jcabello7 | 0:acddf8d6d0cb | 22 | int getAng(); |
jcabello7 | 0:acddf8d6d0cb | 23 | void getStringLlegit(char* str); |
jcabello7 | 0:acddf8d6d0cb | 24 | void comprovaConnexio(); |
jcabello7 | 0:acddf8d6d0cb | 25 | int getTimer(); |
jcabello7 | 0:acddf8d6d0cb | 26 | }; |
jcabello7 | 0:acddf8d6d0cb | 27 | |
jcabello7 | 0:acddf8d6d0cb | 28 | #endif |