Alexandre Salconi-Denis / Mbed 2 deprecated ProjetOctopode

Dependencies:   debug mbed

Files at this revision

API Documentation at this revision

Comitter:
salco
Date:
Tue Mar 10 12:49:59 2015 +0000
Child:
1:25ea21da4542
Commit message:
Creation de tout les doccuments necessaires

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
source/Concience/Conscient.cpp Show annotated file Show diff for this revision Revisions of this file
source/Concience/Conscient.h Show annotated file Show diff for this revision Revisions of this file
source/Concience/Directive.c Show annotated file Show diff for this revision Revisions of this file
source/Concience/Directive.h Show annotated file Show diff for this revision Revisions of this file
source/Concience/InstinctPrimaire.cpp Show annotated file Show diff for this revision Revisions of this file
source/Concience/InstinctPrimaire.h Show annotated file Show diff for this revision Revisions of this file
source/Concience/Subconscient.cpp Show annotated file Show diff for this revision Revisions of this file
source/Concience/Subconscient.h Show annotated file Show diff for this revision Revisions of this file
source/Patte.h Show annotated file Show diff for this revision Revisions of this file
source/SystemeNeuronale/CommunicationNeuronale.c Show annotated file Show diff for this revision Revisions of this file
source/SystemeNeuronale/CommunicationNeuronale.h Show annotated file Show diff for this revision Revisions of this file
source/homemadeSequence.cpp Show annotated file Show diff for this revision Revisions of this file
source/homemadeSequence.h Show annotated file Show diff for this revision Revisions of this file
source/memoireRegistre.c Show annotated file Show diff for this revision Revisions of this file
source/memoireRegistre.h Show annotated file Show diff for this revision Revisions of this file
source/mouvement.cpp Show annotated file Show diff for this revision Revisions of this file
source/mouvement.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Mar 10 12:49:59 2015 +0000
@@ -0,0 +1,69 @@
+
+#include "mbed.h"
+#include "mouvement.h"
+//------------------------------------
+// Hyperterminal configuration
+// 9600 bauds, 8-bit data, no parity
+//------------------------------------
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+Serial ssc32(PA_9, PA_10);
+
+DigitalOut myled(LED1);
+//char str [80];
+char c;
+int main()
+{
+    //  int i = 1;
+
+    //pc.printf("Hello World !\n");
+    //pc.scanf ("%79s",str);
+    //         string test="allo";
+    //    pc.printf(test.c_str());
+
+//////////
+// Boot //
+//////////
+    c=0;
+    Faculter_motrice ctrDesPattes(&/*ssc32*/pc);
+
+    while(1) {
+        wait(1);
+////////////////
+// Inspection //
+////////////////
+        if(pc.readable()) {
+            c=pc.getc();//pc.scanf ("%79s",str);
+            pc.printf("AK %c\n",c);//pc.printf("AK %s\n",str);// pc.printf("This program is %d .\n", i);
+        }
+//////////////////////////////
+// Traitement du Labyrinthe //
+//////////////////////////////
+        if (c == 'g') {
+            ctrDesPattes.calibre();
+            c=0;
+        }
+        if(c == 'h')
+        {
+            pc.printf(" ID seq: %i \n\r",ctrDesPattes.get_idSeq());
+            c=0;
+        }
+///////////////
+// Mouvement //
+///////////////
+        ctrDesPattes.exec();
+////////////////////
+// Update memoire //
+////////////////////
+
+////////////
+// Autre? //
+////////////
+
+
+
+
+
+        myled = !myled;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Mar 10 12:49:59 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9ad691361fac
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/source/Concience/InstinctPrimaire.cpp	Tue Mar 10 12:49:59 2015 +0000
@@ -0,0 +1,12 @@
+////////////////
+// Inspection //
+////////////////
+
+//////////////
+// Decision //
+//////////////
+
+////////////////
+// Traitement //
+////////////////
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/source/Patte.h	Tue Mar 10 12:49:59 2015 +0000
@@ -0,0 +1,246 @@
+/*
+ * Patte.h
+ *
+ *  Created on: Mar 03, 2015
+ *      Author: salco
+ */
+#ifndef PATTE_H_
+#define PATTE_H_
+
+#define NBR_SERVO 32
+#define DEFAULTPOSITION 150
+#define DEFAULTMAX 225
+#define DEFAULTMIN 75
+
+//#include <string>
+#include <stdio.h>
+
+struct servo_t {
+    char iD; //use for ssc-32
+    // all value down is a pulse value between 750-2250 //
+    unsigned char basePose;
+    unsigned char max;
+    unsigned char min;
+    // mabey change curr for a integer to get more precision and less space //
+    unsigned char curr;
+};
+
+class Patte
+{
+    // number related to the SSC-32 //
+    /*char m_numServo_Coxa;
+    char m_numServo_Femur;
+    char m_numServo_Tibia;
+    char m_numServo_Tars;*/
+    char m_id;
+    servo_t m_Coxa;
+    servo_t m_Femur;
+    servo_t m_Tibia;
+    servo_t m_Tars;
+    char buffer [50];
+    
+public:
+    Patte(char patteId,char coxaId,char femurId,char tibiaId,char tarsId) {
+        m_id = patteId;
+
+        m_Coxa.iD  = coxaId;
+        m_Coxa.max = DEFAULTMAX;
+        m_Coxa.min = DEFAULTMIN;
+        m_Coxa.curr= DEFAULTPOSITION;
+
+        m_Femur.iD  = femurId;
+        m_Femur.max = DEFAULTMAX;
+        m_Femur.min = DEFAULTMIN;
+        m_Femur.curr= DEFAULTPOSITION;
+
+        m_Tibia.iD  = tibiaId;
+        m_Tibia.max = DEFAULTMAX;
+        m_Tibia.min = DEFAULTMIN;
+        m_Tibia.curr= DEFAULTPOSITION;
+
+        m_Tars.iD  = tarsId;
+        m_Tars.max = DEFAULTMAX;
+        m_Tars.min = DEFAULTMIN;
+        m_Tars.curr= DEFAULTPOSITION;
+    }
+    virtual ~Patte(){}
+    char id(void) {
+        return m_id;
+    }
+    const char* toString(void){
+       
+       sprintf (buffer,"#%d P%d #%d P%d #%d P%d #%d P%d",m_Coxa.iD,m_Coxa.curr,m_Femur.iD,m_Femur.curr,m_Tibia.iD,m_Tibia.curr,m_Tars.iD,m_Tars.curr);
+       return buffer;
+        }
+    //setting Coxa //
+    void set_Id_Coxa(char id) {
+        m_Coxa.iD = id;
+    }
+    void set_PulseMax_Coxa(unsigned char value) {
+        m_Coxa.max = value;
+    }
+    void set_PulseMin_Coxa(unsigned char value) {
+        m_Coxa.min = value;
+    }
+    void set_DefaultPulse_Coxa(unsigned char value) {
+        m_Coxa.basePose = value;
+    }
+    char get_Id_Coxa(void) {
+        return m_Coxa.iD;
+    }
+    unsigned char get_PulseMax_Coxa(void) {
+        return m_Coxa.max;
+    }
+    unsigned char get_PulseMin_Coxa(void) {
+        return m_Coxa.min;
+    }
+    unsigned char get_DefaultPulse_Coxa(void) {
+        return m_Coxa.basePose;
+    }
+    unsigned char get_CurrentPulse_Coxa(void) {
+        return m_Coxa.curr;
+    }
+    //setting Femur //
+    void set_Id_Femur(char id) {
+        m_Femur.iD = id;
+    }
+    void set_PulseMax_Femur(unsigned char value) {
+        m_Femur.max = value;
+    }
+    void set_PulseMin_Femur(unsigned char value) {
+        m_Femur.min = value;
+    }
+    void set_DefaultPulse_Femur(unsigned char value) {
+        m_Femur.basePose = value;
+    }
+    char get_Id_Femur(void) {
+        return m_Femur.iD;
+    }
+    unsigned char get_PulseMax_Femur(void) {
+        return m_Femur.max;
+    }
+    unsigned char get_PulseMin_Femur(void) {
+        return m_Femur.min;
+    }
+    unsigned char get_DefaultPulse_Femur(void) {
+        return m_Femur.basePose;
+    }
+    unsigned char get_CurrentPulse_Femur(void) {
+        return m_Femur.curr;
+    }
+    //setting Tibia //
+    void set_Id_Tibia(char id) {
+        m_Tibia.iD = id;
+    }
+    void set_PulseMax_Tibia(unsigned char value) {
+        m_Tibia.max = value;
+    }
+    void set_PulseMin_Tibia(unsigned char value) {
+        m_Tibia.min = value;
+    }
+    void set_DefaultPulse_Tibia(unsigned char value) {
+        m_Tibia.basePose = value;
+    }
+    char get_Id_Tibia(void) {
+        return m_Tibia.iD;
+    }
+    unsigned char get_PulseMax_Tibia(void) {
+        return m_Tibia.max;
+    }
+    unsigned char get_PulseMin_Tibia(void) {
+        return m_Tibia.min;
+    }
+    unsigned char get_DefaultPulse_Tibia(void) {
+        return m_Tibia.basePose;
+    }
+    unsigned char get_CurrentPulse_Tibia(void) {
+        return m_Tibia.curr;
+    }
+    //setting Tars //
+    void set_Id_Tars(char id) {
+        m_Tars.iD = id;
+    }
+    void set_PulseMax_Tars(unsigned char value) {
+        m_Tars.max = value;
+    }
+    void set_PulseMin_Tars(unsigned char value) {
+        m_Tars.min = value;
+    }
+    void set_DefaultPulse_Tars(unsigned char value) {
+        m_Tars.basePose = value;
+    }
+    char get_Id_Tars(void) {
+        return m_Tars.iD;
+    }
+    unsigned char get_PulseMax_Tars(void) {
+        return m_Tars.max;
+    }
+    unsigned char get_PulseMin_Tars(void) {
+        return m_Tars.min;
+    }
+    unsigned char get_DefaultPulse_Tars(void) {
+        return m_Tars.basePose;
+    }
+    unsigned char get_CurrentPulse_Tars(void) {
+        return m_Tars.curr;
+    }
+    //setting All-in-one //
+    void set_Id(char coxaId,char femurId,char tibiaId,char tarsId) {
+        m_Coxa.iD = coxaId;
+        m_Femur.iD= femurId;
+        m_Tibia.iD= tibiaId;
+        m_Tars.iD = tarsId;
+    }
+    void set_PulseMax(unsigned char coxaValue,unsigned char femurValue,
+                      unsigned char tibiaValue,unsigned char tarsValue) {
+        m_Coxa.max = coxaValue;
+        m_Femur.max= femurValue;
+        m_Tibia.max= tibiaValue;
+        m_Tars.max = tarsValue;
+    }
+    void set_PulseMin(unsigned char coxaValue,unsigned char femurValue,
+                      unsigned char tibiaValue,unsigned char tarsValue) {
+        m_Coxa.min = coxaValue;
+        m_Femur.min= femurValue;
+        m_Tibia.min= tibiaValue;
+        m_Tars.min = tarsValue;
+    }
+    void set_DefaultPulse(unsigned char coxaValue,unsigned char femurValue,
+                          unsigned char tibiaValue,unsigned char tarsValue) {
+        m_Coxa.basePose = coxaValue;
+        m_Femur.basePose= femurValue;
+        m_Tibia.basePose= tibiaValue;
+        m_Tars.basePose = tarsValue;
+    }
+    //////////
+    // Move //
+    //////////
+    void move_Coxa(unsigned char value) {
+        if((value >= m_Coxa.min)&&(value <= m_Coxa.max ))
+            m_Coxa.curr = value;
+    }
+    void move_Femur(unsigned char value) {
+        if((value >= m_Femur.min)&&(value <= m_Femur.max ))
+            m_Femur.curr = value;
+    }
+    void move_Tibia(unsigned char value) {
+        if((value >= m_Tibia.min)&&(value <= m_Tibia.max ))
+            m_Tibia.curr = value;
+    }
+    void move_Tars(unsigned char value) {
+        if((value >= m_Tars.min)&&(value <= m_Tars.max ))
+            m_Tars.curr = value;
+    }
+    void move(unsigned char coxaValue,unsigned char femurValue,
+              unsigned char tibiaValue,unsigned char tarsValue) {
+        if((coxaValue >= m_Coxa.min)&&(coxaValue <= m_Coxa.max ))
+            m_Coxa.curr = coxaValue;
+        if((femurValue >= m_Femur.min)&&(femurValue <= m_Femur.max ))
+            m_Femur.curr = femurValue;
+        if((tibiaValue >= m_Tibia.min)&&(tibiaValue <= m_Tibia.max ))
+            m_Tibia.curr = tibiaValue;
+        if((tarsValue >= m_Tars.min)&&(tarsValue <= m_Tars.max ))
+            m_Tars.curr = tarsValue;
+    }
+};
+#endif /* PATTE_H_ */
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/source/homemadeSequence.cpp	Tue Mar 10 12:49:59 2015 +0000
@@ -0,0 +1,239 @@
+/*
+ * homemadeSequence.cpp
+ *
+ *  Created on: Mar 03, 2015
+ *      Author: salco
+ */
+#include "homemadeSequence.h"
+homemadeSequence::homemadeSequence()
+{
+m_SequenceChosen=0;
+m_idFrame=0;
+}
+homemadeSequence::~homemadeSequence()
+{
+
+}
+unsigned char* homemadeSequence::get_frame(/*char idSequence,char idOperation,*/char idLeg)
+{
+    m_posLeg[0] = 0;
+    m_posLeg[1] = 0;
+    m_posLeg[2] = 0;
+    m_posLeg[3] = 0;
+
+    switch(m_SequenceChosen) {
+        case 1:// 01 - Calibration(milieu) //
+            if(m_idFrame == 1) {//if(idOperation == 1) {
+                m_posLeg[0] = 150;
+                m_posLeg[1] = 150;
+                m_posLeg[2] = 150;
+                m_posLeg[3] = 150;
+            }
+            break;
+
+        case 2:// 02 - Debout              //
+            seqUpDown(true,m_idFrame,idLeg);//seqUpDown(true,idOperation,idLeg);
+            break;
+        case 3:// 03 - Coucher             //
+            seqUpDown(false,m_idFrame,idLeg);//seqUpDown(false,idOperation,idLeg);
+            break;
+        case 4:// 04 - Tourne Gauche       //
+            break;
+        case 5:// 05 - Tourne Droite       //
+            break;
+        case 6:// 06 - Marche              //
+            break;
+        case 7:// 07 - Recule              //
+            break;
+        case 8:// 07 - Repositioner        //
+            break;
+        case 9:// 09 - Crabe  Gauche       //
+            break;
+        case 10:// 10 - Crabe  Droite       //
+            break;
+    }
+    return m_posLeg;
+}
+
+void homemadeSequence::seqUpDown(bool downUP,char idOperation,char idLeg)
+{
+    if((idOperation<10)&&(idOperation>0)) {
+        switch(idLeg) {
+            case 1:
+                m_posLeg[0] = 140;
+                break;
+            case 2:
+                m_posLeg[0] = 165;
+                break;
+            case 3:
+                m_posLeg[0] = 160;
+                break;
+            case 6:
+                m_posLeg[0] = 133;
+                break;
+            case 7:
+                m_posLeg[0] = 170;
+                break;
+            default:
+                m_posLeg[0] = 150;
+                break;
+        }
+        if(idOperation == 1) {
+            if(idLeg<5) {
+                m_posLeg[1] = 80;
+                m_posLeg[2] = 210;
+                m_posLeg[3] = 160;
+            } else {
+                m_posLeg[1] = 220;
+                m_posLeg[2] = 90;
+                m_posLeg[3] = 114;
+            }
+
+        } else {
+            if(!downUP) {
+                if(idOperation == 9) {
+                    if(idLeg<5) {
+                        m_posLeg[1] = 80;
+                        m_posLeg[2] = 100;
+                        m_posLeg[3] = 150;
+                    } else {
+                        m_posLeg[1] = 220;
+                        m_posLeg[2] = 200;
+                        m_posLeg[3] = 150;
+                    }
+                }
+                idOperation = 10 - idOperation;
+            }
+
+            switch(idOperation) {
+                    /*case 1:
+
+                        break;*/
+                case 2:
+                    if(idLeg<5) {
+                        m_posLeg[1] = 80;
+                        m_posLeg[2] = 220;
+                        m_posLeg[3] = 170;
+                    } else {
+                        m_posLeg[1] = 220;
+                        m_posLeg[2] = 80;
+                        m_posLeg[3] = 130;
+                    }
+                    break;
+                case 3:
+                    if(idLeg<5) {
+                        m_posLeg[1] = 90;
+                        m_posLeg[2] = 220;
+                        m_posLeg[3] = 160;
+                    } else {
+                        m_posLeg[1] = 200;
+                        m_posLeg[2] = 200;
+                        m_posLeg[3] = 140;
+                    }
+                    break;
+                case 4:
+                    if(idLeg<5) {
+                        m_posLeg[1] = 106;
+                        m_posLeg[2] = 220;
+                        m_posLeg[3] = 150;
+                    } else {
+                        m_posLeg[1] = 195;
+                        m_posLeg[2] = 80;
+                        m_posLeg[3] = 150;
+                    }
+                    break;
+                case 5:
+                    if(idLeg<5) {
+                        m_posLeg[1] = 128;
+                        m_posLeg[2] = 220;
+                        m_posLeg[3] = 128;
+                    } else {
+                        m_posLeg[1] = 172;
+                        m_posLeg[2] = 80;
+                        m_posLeg[3] = 173;
+                    }
+                    break;
+                case 6:
+                    if(idLeg<5) {
+                        m_posLeg[1] = 144;
+                        m_posLeg[2] = 205;
+                        m_posLeg[3] = 130;
+                    } else {
+                        m_posLeg[1] = 156;
+                        m_posLeg[2] = 95;
+                        m_posLeg[3] = 170;
+                    }
+                    break;
+                case 7:
+                    if(idLeg<5) {
+                        m_posLeg[1] = 144;
+                        m_posLeg[2] = 211;
+                        m_posLeg[3] = 123;
+                    } else {
+                        m_posLeg[1] = 156;
+                        m_posLeg[2] = 89;
+                        m_posLeg[3] = 177;
+                    }
+                    break;
+                case 8:
+                    if(idLeg<5) {
+                        m_posLeg[1] = 172;
+                        m_posLeg[2] = 185;
+                        m_posLeg[3] = 124;
+                    } else {
+                        m_posLeg[1] = 128;
+                        m_posLeg[2] = 115;
+                        m_posLeg[3] = 176;
+                    }
+                    break;
+                case 9:
+                    if(idLeg<5) {
+                        m_posLeg[1] = 194;
+                        m_posLeg[2] = 166;
+                        m_posLeg[3] = 118;
+                    } else {
+                        m_posLeg[1] = 106;
+                        m_posLeg[2] = 134;
+                        m_posLeg[3] = 182;
+                    }
+                    break;
+            }
+        }
+    }
+}
+void homemadeSequence::seqTurn(bool leftRIGHT,char idOperation,char idLeg)
+{}
+void homemadeSequence::seqWalk(bool backFRONT,char idOperation,char idLeg)
+{}
+void homemadeSequence::seqRepositioner(char idOperation,char idLeg)
+{}
+void homemadeSequence::seqCrabe(bool leftRIGHT,char idOperation,char idLeg)
+{}
+bool homemadeSequence::next_frame(void)
+{
+    bool temp=true;
+    m_idFrame++;
+    unsigned char* tmpTable = get_frame(m_idFrame+1);
+    
+    if((tmpTable[0]==0) && (tmpTable[1]==0) && (tmpTable[2]==0) && (tmpTable[3]==0)) {
+        temp=false;
+        m_idFrame--;//get_frame(m_idFrame);
+    }/* else
+        m_idFrame++;*/
+
+    return temp;
+}
+bool homemadeSequence::prev_frame(void)
+{
+    bool temp=true;
+    m_idFrame--;
+    unsigned char* tmpTable = get_frame(1);
+    
+    if((tmpTable[0]==0) && (tmpTable[1]==0) && (tmpTable[2]==0) && (tmpTable[3]==0)) {
+        temp=false;
+        m_idFrame++;//get_frame(m_idFrame);
+    } /*else
+        m_idFrame--;*/
+
+    return temp;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/source/homemadeSequence.h	Tue Mar 10 12:49:59 2015 +0000
@@ -0,0 +1,51 @@
+/*
+ * homemadeSequence.h
+ *
+ *  Created on: Mar 03, 2015
+ *      Author: salco
+ */
+
+#ifndef HOMEMADESEQUENCE_H_
+#define HOMEMADESEQUENCE_H_
+class homemadeSequence
+{
+    //////////////////////////////
+    // 00 - Nothing             //
+    // 01 - Calibration(milieu) //
+    // 02 - Debout              //
+    // 03 - Coucher             //
+    // 04 - Tourne Gauche       //
+    // 05 - Tourne Droite       //
+    // 06 - Marche              //
+    // 07 - Recule              //
+    // 08 - Repositioner        //
+    // 09 - Crabe  Gauche       //
+    // 10 - Crabe  Droite       //
+    //////////////////////////////
+    char m_SequenceChosen;
+    char m_idFrame;
+
+    unsigned char m_posLeg[4];
+
+    void seqUpDown(bool downUP,char idOperation,char idLeg);
+    void seqTurn(bool leftRIGHT,char idOperation,char idLeg);
+    void seqWalk(bool backFRONT,char idOperation,char idLeg);
+    void seqRepositioner(char idOperation,char idLeg);
+    void seqCrabe(bool leftRIGHT,char idOperation,char idLeg);
+
+public:
+    homemadeSequence();
+    ~homemadeSequence();
+    void set_Sequence(char idSequence) {
+        m_SequenceChosen = idSequence;
+        m_idFrame = 1;
+    }
+    char get_Sequence(void) {
+        return m_SequenceChosen;
+    }
+    unsigned char* get_frame(/*char idSequence,*/char idOperation,char idLeg);
+    unsigned char* get_frame(/*char idSequence,char idOperation,*/char idLeg);
+    bool next_frame(void); //return true if you are not at the end
+    bool prev_frame(void); //return true if you are not at the begining
+};
+#endif /* HOMEMADESEQUENCE_H_ */
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/source/mouvement.cpp	Tue Mar 10 12:49:59 2015 +0000
@@ -0,0 +1,133 @@
+/*
+ * mouvement.cpp
+ *
+ *  Created on: Mar 02, 2015
+ *      Author: salco
+ */
+#include "mouvement.h"
+
+Faculter_motrice::Faculter_motrice(Serial* com):m_com(com)
+{
+    m_seq = new homemadeSequence();
+
+    m_arr_D     = new Patte(1,0,1,2,3);
+    m_arr_mil_D = new Patte(2,4,5,6,7);
+    m_arr_G     = new Patte(3,16,17,18,19);
+    m_arr_mil_G = new Patte(4,20,21,22,23);
+    m_avv_D     = new Patte(5,12,13,14,15);
+    m_avv_mil_D = new Patte(6,8,9,10,11);
+    m_avv_G     = new Patte(7,28,29,30,31);
+    m_avv_mil_G = new Patte(8,24,25,26,27);
+
+    m_SequenceID_arr_D     =0;
+    m_SequenceID_arr_mil_D =0;
+    m_SequenceID_arr_G     =0;
+    m_SequenceID_arr_mil_G =0;
+    m_SequenceID_avv_D     =0;
+    m_SequenceID_avv_mil_D =0;
+    m_SequenceID_avv_G     =0;
+    m_SequenceID_avv_mil_G =0;
+
+    m_ForceStop    = false;
+    m_CriticalStop = false;
+}
+Faculter_motrice::~Faculter_motrice()
+{
+    if(m_seq)
+        delete m_seq;
+    if (m_arr_D)
+        delete m_arr_D;
+    if (m_arr_mil_D)
+        delete m_arr_mil_D;
+    if (m_arr_G)
+        delete m_arr_G;
+    if (m_arr_mil_G)
+        delete m_arr_mil_G;
+
+    if (m_avv_D)
+        delete m_avv_D;
+    if (m_avv_mil_D)
+        delete m_avv_mil_D;
+    if (m_avv_G)
+        delete m_avv_G;
+    if (m_avv_mil_G)
+        delete m_avv_mil_G;
+    return;
+}
+void Faculter_motrice::exec(void)
+{
+#ifdef DEBUG
+    m_com->printf("Flag in exec [%i  :: %i ] \n\r",m_ForceStop,m_seq->get_Sequence());
+#endif
+    if((!m_ForceStop)&&(m_seq->get_Sequence() != 0)) {
+        unsigned char* tempLeg;
+
+
+
+        switch(m_seq->get_Sequence()) {
+            case 1:
+                tempLeg=m_seq->get_frame(m_arr_D->id());
+                m_arr_D->move(tempLeg[0],tempLeg[1],tempLeg[2],tempLeg[3]);
+                //...//
+                if(m_seq->next_frame() == false) {
+                    m_ForceStop=true;
+#ifdef DEBUG
+                    m_com->printf("    Flag next impossible \n\r",m_ForceStop,m_seq->get_Sequence());
+#endif
+                }
+                #ifdef DEBUG
+                else
+                    m_com->printf("    Flag next possible \n\r",m_ForceStop,m_seq->get_Sequence());
+#endif
+                break;
+        }
+        //char buffer[50];
+        //scanf(buffer,"%s T%d\n\r",m_arr_D->toString(),DELAITESTE);
+        m_com->printf("%s T%d\n\r",m_arr_D->toString(),DELAITESTE);
+
+        /*
+                    tempLeg=m_seq->get_frame(m_arr_D->id());
+        m_com->printf("This program is %d .\n", tempLeg[0]);*/
+    }
+#ifdef DEBUG
+    m_com->printf("Flag out exec [%i  :: %i ] \n\r",m_ForceStop,m_seq->get_Sequence());
+#endif
+}
+/*void Faculter_motrice::moveLeft (void)
+{
+    m_seq->set_Sequence(9);
+}
+void Faculter_motrice::moveRight(void)
+{
+
+}
+void Faculter_motrice::moveUp   (void)
+{
+
+}
+void Faculter_motrice::moveDown (void)
+{
+
+}
+void Faculter_motrice::moveFront(void)
+{
+
+}
+void Faculter_motrice::moveBack (void)
+{
+
+}
+void Faculter_motrice::turnLeft (void)
+{
+
+}
+void Faculter_motrice::trunRight(void)
+{
+
+}*/
+void Faculter_motrice::crit_stop(void)
+{
+    m_com->printf("#0L #1L #2L #3L #4L #5L #6L #7L #8L #9L #10L #11L #12L #13L #14L #15L #16L #17L #18L #19L #20L #21L #22L #23L #24L #25L #26L #27L #28L #29L #30L #31L #32L\n\r");
+    m_ForceStop=true;
+    m_CriticalStop=true;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/source/mouvement.h	Tue Mar 10 12:49:59 2015 +0000
@@ -0,0 +1,118 @@
+/*
+ * mouvement.h
+ *
+ *  Created on: Mar 02, 2015
+ *      Author: salco
+ */
+
+/*
+ * Theraphosa Salconi
+ *
+ * Jambes[coxa/fermur/tibia/tars]+numeroMoteur:
+ *
+ * Arr-D: [0,1,2,3]
+ * Arr-G: [16,17,18,19]
+ * Arr-Mil-D: [4,5,6,7]
+ * Arr-Mil-G: [20,21,22,23]
+ * Avv-Mil-D: [8,9,10,11]
+ * Avv-Mil-G: [24,25,26,27]
+ * Avv-D: [12,13,14,15]
+ * Avv-G: [28,29,30,31]
+ *
+ */
+#ifndef MOUVEMENT_H_
+#define MOUVEMENT_H_
+
+#define DELAITESTE 1000
+#define DEBUG
+
+#include "mbed.h"
+//#include <string>
+//#include <stdio.h>
+#include "Patte.h"
+#include "homemadeSequence.h"
+
+
+class Faculter_motrice
+{
+    Serial* m_com;
+    homemadeSequence* m_seq;
+
+    Patte *m_arr_D;
+    char m_SequenceID_arr_D;
+    Patte *m_arr_mil_D;
+    char m_SequenceID_arr_mil_D;
+    Patte *m_arr_G;
+    char m_SequenceID_arr_G;
+    Patte *m_arr_mil_G;
+    char m_SequenceID_arr_mil_G;
+    Patte *m_avv_D;
+    char m_SequenceID_avv_D;
+    Patte *m_avv_mil_D;
+    char m_SequenceID_avv_mil_D;
+    Patte *m_avv_G;
+    char m_SequenceID_avv_G;
+    Patte *m_avv_mil_G;
+    char m_SequenceID_avv_mil_G;
+
+// Flag //
+    bool m_ForceStop; // use when you want pause the motion
+    bool m_CriticalStop; // use to turn off all legs
+    bool m_SeqChange;
+
+//  //
+// char m_SequenceChosen;
+// A enlever au plus vite car sa prend beaucoup d'espace //
+
+
+public:
+#ifdef DEBUG
+    char get_idSeq(void){return m_seq->get_Sequence();}
+#endif
+    Faculter_motrice(Serial* com);
+    virtual ~Faculter_motrice();
+
+    void exec(void);
+    void stop(void) {
+        m_ForceStop= true;
+    }
+    void resume(void) {
+        m_ForceStop=false;
+        m_CriticalStop=false;
+    }
+    void crit_stop(void);
+    
+    void moveLeft (void) {
+        m_seq->set_Sequence(9);
+    }
+    void moveRight(void){
+        m_seq->set_Sequence(10);
+    }
+    void moveUp   (void){
+        m_seq->set_Sequence(2);
+    }
+    void moveDown (void){
+        m_seq->set_Sequence(3);
+    }
+    void moveFront(void){
+        m_seq->set_Sequence(6);
+    }
+    void moveBack (void){
+        m_seq->set_Sequence(7);
+    }
+    void turnLeft (void){
+        m_seq->set_Sequence(4);
+    }
+    void trunRight(void){
+        m_seq->set_Sequence(5);
+    }
+    void calibre  (void){
+        m_seq->set_Sequence(1);
+    }
+    //void repositioner(char idLeg);
+
+
+
+};
+
+#endif /* MOUVEMENT_H_ */
\ No newline at end of file