Projet robot / Bluetooth_HC05_LE_TRAME

Dependents:   robot_final

Revision:
2:7d02a128e1e3
Parent:
1:7cc085e87bb0
Child:
3:8fd068b00d9c
diff -r 7cc085e87bb0 -r 7d02a128e1e3 Bluetooth_HC05_LE_TRAME.cpp
--- a/Bluetooth_HC05_LE_TRAME.cpp	Fri Mar 17 18:14:59 2017 +0000
+++ b/Bluetooth_HC05_LE_TRAME.cpp	Sat Mar 18 11:13:44 2017 +0000
@@ -33,9 +33,9 @@
          wait(1);
 }
          
-char Bluetooth_HC05_LE_TRAME::recevoir(int longueur)          //1 ere tentative
+void Bluetooth_HC05_LE_TRAME::recevoir()          //1 ere tentative
 {
-         //char* recu=NULL;
+         char* recu=NULL;
          
          
        
@@ -47,17 +47,24 @@
                  ///////////////////////////////////////////////OK rematrre apres
                if(seriale.readable())
                 {
-                  //    for(i=0;i<longueur;i++)
-                  //  {
+                      for(i=0;i<4;i++)
+                    {
                      buffer[compteur]=seriale.getc();
                       compteur++;
-                  //  }
+                  }
                 }
                 
-                char buffer_copie[compteur];
+              /*  char buffer_copie[compteur];
                 
                 for(i=0;i<compteur;i++)
+                {
                 buffer_copie[i]=buffer[i];
+                }*/
+                
+                for(i=0;i<compteur;i++)
+                {
+                this->buf[i]=buffer[i];
+                }
                 
                 //recu=buffer;
                 
@@ -68,8 +75,9 @@
                  
                 //  this->resetBuffer();
                  // char*recu=&buffer_copie[0];
-                char recu= buffer_copie[0];
-                 return(recu); 
+               
+               
+                // return(recu);
                  
                         
 }
@@ -94,3 +102,9 @@
     ok=1;
     return ok;
 }
+
+char* Bluetooth_HC05_LE_TRAME::getBuf()
+{
+    return(this->buf);
+}
+