![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
robot final c est la fin
Dependencies: AFFICHAGE Bluetooth_HC05_LE_TRAME Deplacement LED_Debug PATTERN LED SRF05 m3pi mbed ROBOT
Diff: main.cpp
- Revision:
- 0:238a3e4fa7bc
- Child:
- 1:1d7dc9751783
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Mar 17 18:17:06 2017 +0000 @@ -0,0 +1,128 @@ +#include "mbed.h" +#include "LED_Debug.h" +#include "Robot.h" +#include "Bluetooth_HC05_LE_TRAME.h" + + + + + + //mot de passe PIN 1390 +//Serial HC06(p13,p14); +Serial pc(USBTX,USBRX); + + + +int main() { + + Bluetooth_HC05_LE_TRAME blu; + Robot robot; + LED_Debug d; + + + d.add(); + pc.printf("DEBUT\r\n"); + + pc.printf("CONFIGURATION BAUDS OK\r\n"); + + blu.envoyer("bonjour\r\n"); + d.add(); + + + +//////////////////////////////////////////// + + blu.resetBuffer(); + +/////////////////////////////////////////// + + int copie; + int i=0; + + while(1) + { + + if (blu.donneesRecue()==1) { + d.resetCpt(); + + pc.printf(" 0k1\r\n"); + + + + + + int compteur=0; + char buffer[100]; + ///////////////////////////////////////////////OK rematrre apres + while(blu.donneesRecue()==1) + { + buffer[0]=blu.recevoir(1); + pc.printf("recevoir= %c\r\n",buffer[0]); + + + // buffer[compteur]=toto; + // compteur++; + + + } + pc.printf(" ok2\r\n"); + // blu.resetBuffer(); + //////////////////////////////////////////// + pc.printf(" ok3\r\n"); + // char*recu=blu.recevoir(1); + //char *recu=&buffer[0]; + /////////////////////////////////////////// test + + + + /////////////////////////////////////// + + + + pc.printf(" ok4\r\n"); + pc.printf("envoi = %c ",buffer[0]); + pc.printf(" ok5\r\n"); + blu.envoyer("hello\r\n"); + pc.printf(" ok6\r\n"); + blu.envoyer("salut je suis un robot\r\n"); + pc.printf(" ok7\r\n"); + + + + + ////////////////////////////////////////// + + pc.printf(" ok8\r\n"); + //////////////////////////////////////////////// + pc.printf("ROBOT ACTION\r\n"); + d.add(); + + + + // robot.action(recu[0]); + pc.printf("%c \r\n",buffer[0]); + + pc.printf(" ok9\r\n"); + + robot.action(buffer[0]); + + d.add(); + pc.printf("ROBOT ACTION FIN\r\n"); + pc.printf(" ok10\r\n"); + //////////////////////////////////////////////////// + + + + /////////////////////////////////////// + + blu.resetBuffer(); + pc.printf(" ok11\r\n"); + //////////////////////////////// + + wait(2); + pc.printf(" ok12\r\n"); + + } + +} +}