CRAC Team / Mbed 2 deprecated PHARE2021

Dependencies:   mbed bloc_8_pompe2 Herkulex_library_2022 ident_crac1 bloc_pompe2

Revision:
3:77e937c315f1
Parent:
2:c7f2e7d8b305
--- a/Action_bras/actions.cpp	Tue Mar 08 16:03:27 2022 +0000
+++ b/Action_bras/actions.cpp	Tue Apr 26 14:08:43 2022 +0000
@@ -3,25 +3,12 @@
 uint8_t servos_bras_testeur[2] = {RLED_ON, 1}; 
 uint16_t pos_testeur[1] = {400};
 
-void fct_opti(void)
-{
-    //positionControl_Mul_ensemble_complex(1, 60, servos_bras_testeur, pos_testeur, SERIAL_BAS_DROITE);
-//(uint8_t nb_servo, uint8_t playtime, uint8_t* data, uint16_t* pos, uint8_t numero_serial) // uint16_t position, uint8_t setLED, uint8_t id
-    //wait_ms(3000);
-    positionControl(AR_HAUT, 750, PLAYTIME, GLED_ON, SERIAL_BAS_DROITE);
-    positionControl_Mul_ensemble(AR_BASE, 1000, PLAYTIME, GLED_ON, AR_MILIEU, 160, GLED_ON, SERIAL_BAS_DROITE);
-    wait_ms(TEMPO_LONGUE);
-    positionControl(AR_HAUT, 650, PLAYTIME, GLED_ON, SERIAL_BAS_DROITE);
-    positionControl_Mul_ensemble(AR_BASE, 500, PLAYTIME, GLED_ON, AR_MILIEU, 600, GLED_ON, SERIAL_BAS_DROITE);
-    wait_ms(TEMPO_LONGUE);
-}
-
-void fct_prise_avant(char serial_select)
+/*void fct_prise_avant(char serial_select) //moteurs 1,2,3
 {
     //Rangement
     positionControl_Mul_ensemble(AV_BASE, 1000, PLAYTIME, RLED_ON, AV_MILIEU, 160, RLED_ON, serial_select);
     positionControl(AV_HAUT, 750, PLAYTIME, RLED_ON, serial_select);
-    wait_ms(2000);
+    wait_ms(TEMPO);
     //Pré Prise
     positionControl(AV_HAUT, 650, PLAYTIME, GLED_ON, serial_select);
     positionControl_Mul_ensemble(AV_BASE, 500, PLAYTIME, GLED_ON, AV_MILIEU, 600, GLED_ON, serial_select);
@@ -33,28 +20,50 @@
     //Rangement echantillon
     positionControl_Mul_ensemble(AV_BASE, 1000, PLAYTIME, BLED_ON, AV_MILIEU, 160, BLED_ON, serial_select);
     positionControl(AV_HAUT, 510, PLAYTIME, BLED_ON, serial_select);
+    wait_ms(TEMPO);
+}*/
+
+void fct_prise_arriere(char serial_select) //moteurs 4,5,6
+{
+    //Rangement
+    positionControl_Mul_ensemble(BAR_BASE, 1000, PLAYTIME, RLED_ON, BAR_MILIEU, 160, RLED_ON, serial_select);
+    positionControl(BAR_HAUT, 750, PLAYTIME, RLED_ON, serial_select);
+    wait_ms(2000);
+    //Pré Prise
+    positionControl(BAR_HAUT, 650, PLAYTIME, GLED_ON, serial_select);
+    positionControl_Mul_ensemble(BAR_BASE, 500, PLAYTIME, GLED_ON, BAR_MILIEU, 600, GLED_ON, serial_select);
+    wait_ms(TEMPO_LONGUE);
+    //Prise
+    positionControl(BAR_HAUT, 685, PLAYTIME, GLED_ON, serial_select);
+    positionControl_Mul_ensemble(BAR_BASE, 445, PLAYTIME, GLED_ON, BAR_MILIEU, 590, GLED_ON, serial_select);
+    wait_ms(TEMPO_LONGUE);
+    //Rangement echantillon
+    positionControl_Mul_ensemble(BAR_BASE, 1000, PLAYTIME, BLED_ON, BAR_MILIEU, 160, BLED_ON, serial_select);
+    positionControl(BAR_HAUT, 510, PLAYTIME, BLED_ON, serial_select);
     wait_ms(3000);
 }
 
-void fct_prise_arriere(char serial_select)
+
+void fct_prise(char moteur1, char moteur2, char moteur3,char serial_select)
 {
     //Rangement
-    positionControl_Mul_ensemble(AR_BASE, 1000, PLAYTIME, RLED_ON, AR_MILIEU, 160, RLED_ON, serial_select);
-    positionControl(AR_HAUT, 750, PLAYTIME, RLED_ON, serial_select);
+    positionControl_Mul_ensemble(moteur1, 570, PLAYTIME, RLED_ON, moteur2, 160, RLED_ON, serial_select);
+    positionControl(moteur3, 750, PLAYTIME, RLED_ON, serial_select);
     wait_ms(2000);
     //Pré Prise
-    positionControl(AR_HAUT, 650, PLAYTIME, GLED_ON, serial_select);
-    positionControl_Mul_ensemble(AR_BASE, 500, PLAYTIME, GLED_ON, AR_MILIEU, 600, GLED_ON, serial_select);
-    wait_ms(TEMPO_LONGUE);
+    positionControl(moteur3, 650, PLAYTIME, GLED_ON, serial_select);
+    positionControl_Mul_ensemble(moteur1, 500, PLAYTIME, GLED_ON, moteur2, 600, GLED_ON, serial_select);
+    wait_ms(2000);
     //Prise
-    positionControl(AR_HAUT, 685, PLAYTIME, GLED_ON, serial_select);
-    positionControl_Mul_ensemble(AR_BASE, 445, PLAYTIME, GLED_ON, AR_MILIEU, 590, GLED_ON, serial_select);
-    wait_ms(TEMPO_LONGUE);
+    positionControl(moteur3, 685, PLAYTIME, GLED_ON, serial_select);
+    positionControl_Mul_ensemble(moteur1, 445, PLAYTIME, GLED_ON, moteur2, 590, GLED_ON, serial_select);
+    wait_ms(2000);
     //Rangement echantillon
-    positionControl_Mul_ensemble(AR_BASE, 1000, PLAYTIME, BLED_ON, AR_MILIEU, 160, BLED_ON, serial_select);
-    positionControl(AR_HAUT, 510, PLAYTIME, BLED_ON, serial_select);
-    wait_ms(3000);
+    positionControl_Mul_ensemble(moteur1, 1000, PLAYTIME, BLED_ON, moteur2, 160, BLED_ON, serial_select);
+    positionControl(moteur3, 510, PLAYTIME, BLED_ON, serial_select);
+    wait_ms(2000);
 }
+/*
 
 void fct_bras(void)
 {
@@ -94,4 +103,56 @@
     positionControl_Mul_ensemble(AV_HAUT, 750, PLAYTIME, RLED_ON, AV_MILIEU, 160, RLED_ON, SERIAL_BAS_GAUCHE);
     positionControl(AV_BASE, 1000, PLAYTIME, RLED_ON, SERIAL_BAS_GAUCHE);
     wait_ms(TEMPO);
+}*/
+
+void fct_bras_arriere(char serial_select)
+{
+//Rangement bras bas
+    positionControl_Mul_ensemble(BAR_BASE, 1000, PLAYTIME, RLED_ON, BAR_MILIEU, 160, RLED_ON, serial_select);
+    positionControl(BAR_HAUT, 750, PLAYTIME, RLED_ON, serial_select);
+    wait_ms(TEMPO);
+//Rangement bras haut
+    positionControl_Mul_ensemble(HAR_BASE, 955, PLAYTIME, RLED_ON, HAR_MILIEU, 35, RLED_ON, serial_select);
+    positionControl(HAR_HAUT, 230, PLAYTIME, RLED_ON, serial_select);
+    wait_ms(TEMPO_LONGUE);
+    
+//Prise bras bas
+    positionControl(BAR_HAUT, 685, PLAYTIME, GLED_ON, serial_select);
+    positionControl_Mul_ensemble(BAR_BASE, 445, PLAYTIME, GLED_ON, BAR_MILIEU, 600, GLED_ON, serial_select);
+    wait_ms(TEMPO_LONGUE);
+//Passe bras bas
+    positionControl_Mul_ensemble(BAR_BASE, 470, 40, BLED_ON, BAR_MILIEU, 800, BLED_ON, serial_select);
+    wait_ms(TEMPO+250);
+    positionControl(BAR_HAUT, 250, 40, BLED_ON, serial_select);
+    wait_ms(TEMPO_LONGUE);
+    
+//Prise bras haut
+    positionControl(HAR_HAUT, 630, PLAYTIME, GLED_ON, serial_select);
+    wait_ms(500);
+    positionControl_Mul_ensemble(HAR_BASE, 800, PLAYTIME, GLED_ON, HAR_MILIEU, 110, GLED_ON, serial_select);
+    wait_ms(TEMPO_LONGUE);
+//Pré rangement bras haut
+    positionControl_Mul_ensemble(HAR_BASE, 920, PLAYTIME, RLED_ON, HAR_MILIEU, 70, RLED_ON, serial_select);
+    positionControl(HAR_HAUT, 650, PLAYTIME, RLED_ON, serial_select);
+    
+//Pré rangement bras bas
+    positionControl_Mul_ensemble(BAR_BASE, 520, PLAYTIME, RLED_ON, BAR_MILIEU, 160, RLED_ON, serial_select);
+    positionControl(BAR_HAUT, 750, PLAYTIME, RLED_ON, serial_select);
+    wait_ms(TEMPO_LONGUE);
+//Rangement bras bas
+    positionControl_Mul_ensemble(BAR_HAUT, 750, PLAYTIME, RLED_ON, BAR_MILIEU, 160, RLED_ON, serial_select);
+    positionControl(BAR_BASE, 1000, PLAYTIME, RLED_ON, serial_select);
+    wait_ms(TEMPO);
+}
+
+void activer_CN(void)
+{
+    positionControl_Mul_ensemble(CN_GAUCHE, 790, PLAYTIME, RLED_ON, CN_DROITE, 240, RLED_ON, SERIAL_SPECIAL);
+    wait_ms(TEMPO);
+}
+
+void desactiver_CN(void)
+{
+    positionControl_Mul_ensemble(CN_GAUCHE, 240, PLAYTIME, RLED_ON, CN_DROITE, 790, RLED_ON, SERIAL_SPECIAL);
+    wait_ms(TEMPO);
 }
\ No newline at end of file