Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed bloc_8_pompe2 Herkulex_library_2022 ident_crac1 bloc_pompe2
Action_bras/actions.cpp@3:77e937c315f1, 2022-04-26 (annotated)
- Committer:
- ares1999
- Date:
- Tue Apr 26 14:08:43 2022 +0000
- Revision:
- 3:77e937c315f1
- Parent:
- 2:c7f2e7d8b305
mesure position servo 4 5 6 sur serial 2
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ares1999 | 2:c7f2e7d8b305 | 1 | #include "actions.h" |
| ares1999 | 2:c7f2e7d8b305 | 2 | |
| ares1999 | 2:c7f2e7d8b305 | 3 | uint8_t servos_bras_testeur[2] = {RLED_ON, 1}; |
| ares1999 | 2:c7f2e7d8b305 | 4 | uint16_t pos_testeur[1] = {400}; |
| ares1999 | 2:c7f2e7d8b305 | 5 | |
| ares1999 | 3:77e937c315f1 | 6 | /*void fct_prise_avant(char serial_select) //moteurs 1,2,3 |
| ares1999 | 2:c7f2e7d8b305 | 7 | { |
| ares1999 | 2:c7f2e7d8b305 | 8 | //Rangement |
| ares1999 | 2:c7f2e7d8b305 | 9 | positionControl_Mul_ensemble(AV_BASE, 1000, PLAYTIME, RLED_ON, AV_MILIEU, 160, RLED_ON, serial_select); |
| ares1999 | 2:c7f2e7d8b305 | 10 | positionControl(AV_HAUT, 750, PLAYTIME, RLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 11 | wait_ms(TEMPO); |
| ares1999 | 2:c7f2e7d8b305 | 12 | //Pré Prise |
| ares1999 | 2:c7f2e7d8b305 | 13 | positionControl(AV_HAUT, 650, PLAYTIME, GLED_ON, serial_select); |
| ares1999 | 2:c7f2e7d8b305 | 14 | positionControl_Mul_ensemble(AV_BASE, 500, PLAYTIME, GLED_ON, AV_MILIEU, 600, GLED_ON, serial_select); |
| ares1999 | 2:c7f2e7d8b305 | 15 | wait_ms(TEMPO_LONGUE); |
| ares1999 | 2:c7f2e7d8b305 | 16 | //Prise |
| ares1999 | 2:c7f2e7d8b305 | 17 | positionControl(AV_HAUT, 685, PLAYTIME, GLED_ON, serial_select); |
| ares1999 | 2:c7f2e7d8b305 | 18 | positionControl_Mul_ensemble(AV_BASE, 445, PLAYTIME, GLED_ON, AV_MILIEU, 590, GLED_ON, serial_select); |
| ares1999 | 2:c7f2e7d8b305 | 19 | wait_ms(TEMPO_LONGUE); |
| ares1999 | 2:c7f2e7d8b305 | 20 | //Rangement echantillon |
| ares1999 | 2:c7f2e7d8b305 | 21 | positionControl_Mul_ensemble(AV_BASE, 1000, PLAYTIME, BLED_ON, AV_MILIEU, 160, BLED_ON, serial_select); |
| ares1999 | 2:c7f2e7d8b305 | 22 | positionControl(AV_HAUT, 510, PLAYTIME, BLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 23 | wait_ms(TEMPO); |
| ares1999 | 3:77e937c315f1 | 24 | }*/ |
| ares1999 | 3:77e937c315f1 | 25 | |
| ares1999 | 3:77e937c315f1 | 26 | void fct_prise_arriere(char serial_select) //moteurs 4,5,6 |
| ares1999 | 3:77e937c315f1 | 27 | { |
| ares1999 | 3:77e937c315f1 | 28 | //Rangement |
| ares1999 | 3:77e937c315f1 | 29 | positionControl_Mul_ensemble(BAR_BASE, 1000, PLAYTIME, RLED_ON, BAR_MILIEU, 160, RLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 30 | positionControl(BAR_HAUT, 750, PLAYTIME, RLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 31 | wait_ms(2000); |
| ares1999 | 3:77e937c315f1 | 32 | //Pré Prise |
| ares1999 | 3:77e937c315f1 | 33 | positionControl(BAR_HAUT, 650, PLAYTIME, GLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 34 | positionControl_Mul_ensemble(BAR_BASE, 500, PLAYTIME, GLED_ON, BAR_MILIEU, 600, GLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 35 | wait_ms(TEMPO_LONGUE); |
| ares1999 | 3:77e937c315f1 | 36 | //Prise |
| ares1999 | 3:77e937c315f1 | 37 | positionControl(BAR_HAUT, 685, PLAYTIME, GLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 38 | positionControl_Mul_ensemble(BAR_BASE, 445, PLAYTIME, GLED_ON, BAR_MILIEU, 590, GLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 39 | wait_ms(TEMPO_LONGUE); |
| ares1999 | 3:77e937c315f1 | 40 | //Rangement echantillon |
| ares1999 | 3:77e937c315f1 | 41 | positionControl_Mul_ensemble(BAR_BASE, 1000, PLAYTIME, BLED_ON, BAR_MILIEU, 160, BLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 42 | positionControl(BAR_HAUT, 510, PLAYTIME, BLED_ON, serial_select); |
| ares1999 | 2:c7f2e7d8b305 | 43 | wait_ms(3000); |
| ares1999 | 2:c7f2e7d8b305 | 44 | } |
| ares1999 | 2:c7f2e7d8b305 | 45 | |
| ares1999 | 3:77e937c315f1 | 46 | |
| ares1999 | 3:77e937c315f1 | 47 | void fct_prise(char moteur1, char moteur2, char moteur3,char serial_select) |
| ares1999 | 2:c7f2e7d8b305 | 48 | { |
| ares1999 | 2:c7f2e7d8b305 | 49 | //Rangement |
| ares1999 | 3:77e937c315f1 | 50 | positionControl_Mul_ensemble(moteur1, 570, PLAYTIME, RLED_ON, moteur2, 160, RLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 51 | positionControl(moteur3, 750, PLAYTIME, RLED_ON, serial_select); |
| ares1999 | 2:c7f2e7d8b305 | 52 | wait_ms(2000); |
| ares1999 | 2:c7f2e7d8b305 | 53 | //Pré Prise |
| ares1999 | 3:77e937c315f1 | 54 | positionControl(moteur3, 650, PLAYTIME, GLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 55 | positionControl_Mul_ensemble(moteur1, 500, PLAYTIME, GLED_ON, moteur2, 600, GLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 56 | wait_ms(2000); |
| ares1999 | 2:c7f2e7d8b305 | 57 | //Prise |
| ares1999 | 3:77e937c315f1 | 58 | positionControl(moteur3, 685, PLAYTIME, GLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 59 | positionControl_Mul_ensemble(moteur1, 445, PLAYTIME, GLED_ON, moteur2, 590, GLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 60 | wait_ms(2000); |
| ares1999 | 2:c7f2e7d8b305 | 61 | //Rangement echantillon |
| ares1999 | 3:77e937c315f1 | 62 | positionControl_Mul_ensemble(moteur1, 1000, PLAYTIME, BLED_ON, moteur2, 160, BLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 63 | positionControl(moteur3, 510, PLAYTIME, BLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 64 | wait_ms(2000); |
| ares1999 | 2:c7f2e7d8b305 | 65 | } |
| ares1999 | 3:77e937c315f1 | 66 | /* |
| ares1999 | 2:c7f2e7d8b305 | 67 | |
| ares1999 | 2:c7f2e7d8b305 | 68 | void fct_bras(void) |
| ares1999 | 2:c7f2e7d8b305 | 69 | { |
| ares1999 | 2:c7f2e7d8b305 | 70 | //Rangement bras bas |
| ares1999 | 2:c7f2e7d8b305 | 71 | positionControl_Mul_ensemble(AV_BASE, 1000, PLAYTIME, RLED_ON, AV_MILIEU, 160, RLED_ON, SERIAL_BAS_GAUCHE); |
| ares1999 | 2:c7f2e7d8b305 | 72 | positionControl(AV_HAUT, 750, PLAYTIME, RLED_ON, SERIAL_BAS_GAUCHE); |
| ares1999 | 2:c7f2e7d8b305 | 73 | wait_ms(TEMPO); |
| ares1999 | 2:c7f2e7d8b305 | 74 | //Rangement bras haut |
| ares1999 | 2:c7f2e7d8b305 | 75 | positionControl_Mul_ensemble(AV_BASE, 955, PLAYTIME, RLED_ON, AV_MILIEU, 35, RLED_ON, SERIAL_HAUT); |
| ares1999 | 2:c7f2e7d8b305 | 76 | positionControl(AV_HAUT, 230, PLAYTIME, RLED_ON, SERIAL_HAUT); |
| ares1999 | 2:c7f2e7d8b305 | 77 | wait_ms(TEMPO_LONGUE); |
| ares1999 | 2:c7f2e7d8b305 | 78 | |
| ares1999 | 2:c7f2e7d8b305 | 79 | //Prise bras bas |
| ares1999 | 2:c7f2e7d8b305 | 80 | positionControl(AV_HAUT, 685, PLAYTIME, GLED_ON, SERIAL_BAS_GAUCHE); |
| ares1999 | 2:c7f2e7d8b305 | 81 | positionControl_Mul_ensemble(AV_BASE, 445, PLAYTIME, GLED_ON, AV_MILIEU, 600, GLED_ON, SERIAL_BAS_GAUCHE); |
| ares1999 | 2:c7f2e7d8b305 | 82 | wait_ms(TEMPO_LONGUE); |
| ares1999 | 2:c7f2e7d8b305 | 83 | //Passe bras bas |
| ares1999 | 2:c7f2e7d8b305 | 84 | positionControl_Mul_ensemble(AV_BASE, 470, 40, BLED_ON, AV_MILIEU, 800, BLED_ON, SERIAL_BAS_GAUCHE); |
| ares1999 | 2:c7f2e7d8b305 | 85 | wait_ms(TEMPO+250); |
| ares1999 | 2:c7f2e7d8b305 | 86 | positionControl(AV_HAUT, 250, 40, BLED_ON, SERIAL_BAS_GAUCHE); |
| ares1999 | 2:c7f2e7d8b305 | 87 | wait_ms(TEMPO_LONGUE); |
| ares1999 | 2:c7f2e7d8b305 | 88 | |
| ares1999 | 2:c7f2e7d8b305 | 89 | //Prise bras haut |
| ares1999 | 2:c7f2e7d8b305 | 90 | positionControl(AV_HAUT, 630, PLAYTIME, GLED_ON, SERIAL_HAUT); |
| ares1999 | 2:c7f2e7d8b305 | 91 | wait_ms(500); |
| ares1999 | 2:c7f2e7d8b305 | 92 | positionControl_Mul_ensemble(AV_BASE, 800, PLAYTIME, GLED_ON, AV_MILIEU, 110, GLED_ON, SERIAL_HAUT); |
| ares1999 | 2:c7f2e7d8b305 | 93 | wait_ms(TEMPO_LONGUE); |
| ares1999 | 2:c7f2e7d8b305 | 94 | //Pré rangement bras haut |
| ares1999 | 2:c7f2e7d8b305 | 95 | positionControl_Mul_ensemble(AV_BASE, 920, PLAYTIME, RLED_ON, AV_MILIEU, 70, RLED_ON, SERIAL_HAUT); |
| ares1999 | 2:c7f2e7d8b305 | 96 | positionControl(AV_HAUT, 650, PLAYTIME, RLED_ON, SERIAL_HAUT); |
| ares1999 | 2:c7f2e7d8b305 | 97 | |
| ares1999 | 2:c7f2e7d8b305 | 98 | //Pré rangement bras bas |
| ares1999 | 2:c7f2e7d8b305 | 99 | positionControl_Mul_ensemble(AV_BASE, 520, PLAYTIME, RLED_ON, AV_MILIEU, 160, RLED_ON, SERIAL_BAS_GAUCHE); |
| ares1999 | 2:c7f2e7d8b305 | 100 | positionControl(AV_HAUT, 750, PLAYTIME, RLED_ON, SERIAL_BAS_GAUCHE); |
| ares1999 | 2:c7f2e7d8b305 | 101 | wait_ms(TEMPO_LONGUE); |
| ares1999 | 2:c7f2e7d8b305 | 102 | //Rangement bras bas |
| ares1999 | 2:c7f2e7d8b305 | 103 | positionControl_Mul_ensemble(AV_HAUT, 750, PLAYTIME, RLED_ON, AV_MILIEU, 160, RLED_ON, SERIAL_BAS_GAUCHE); |
| ares1999 | 2:c7f2e7d8b305 | 104 | positionControl(AV_BASE, 1000, PLAYTIME, RLED_ON, SERIAL_BAS_GAUCHE); |
| ares1999 | 2:c7f2e7d8b305 | 105 | wait_ms(TEMPO); |
| ares1999 | 3:77e937c315f1 | 106 | }*/ |
| ares1999 | 3:77e937c315f1 | 107 | |
| ares1999 | 3:77e937c315f1 | 108 | void fct_bras_arriere(char serial_select) |
| ares1999 | 3:77e937c315f1 | 109 | { |
| ares1999 | 3:77e937c315f1 | 110 | //Rangement bras bas |
| ares1999 | 3:77e937c315f1 | 111 | positionControl_Mul_ensemble(BAR_BASE, 1000, PLAYTIME, RLED_ON, BAR_MILIEU, 160, RLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 112 | positionControl(BAR_HAUT, 750, PLAYTIME, RLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 113 | wait_ms(TEMPO); |
| ares1999 | 3:77e937c315f1 | 114 | //Rangement bras haut |
| ares1999 | 3:77e937c315f1 | 115 | positionControl_Mul_ensemble(HAR_BASE, 955, PLAYTIME, RLED_ON, HAR_MILIEU, 35, RLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 116 | positionControl(HAR_HAUT, 230, PLAYTIME, RLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 117 | wait_ms(TEMPO_LONGUE); |
| ares1999 | 3:77e937c315f1 | 118 | |
| ares1999 | 3:77e937c315f1 | 119 | //Prise bras bas |
| ares1999 | 3:77e937c315f1 | 120 | positionControl(BAR_HAUT, 685, PLAYTIME, GLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 121 | positionControl_Mul_ensemble(BAR_BASE, 445, PLAYTIME, GLED_ON, BAR_MILIEU, 600, GLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 122 | wait_ms(TEMPO_LONGUE); |
| ares1999 | 3:77e937c315f1 | 123 | //Passe bras bas |
| ares1999 | 3:77e937c315f1 | 124 | positionControl_Mul_ensemble(BAR_BASE, 470, 40, BLED_ON, BAR_MILIEU, 800, BLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 125 | wait_ms(TEMPO+250); |
| ares1999 | 3:77e937c315f1 | 126 | positionControl(BAR_HAUT, 250, 40, BLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 127 | wait_ms(TEMPO_LONGUE); |
| ares1999 | 3:77e937c315f1 | 128 | |
| ares1999 | 3:77e937c315f1 | 129 | //Prise bras haut |
| ares1999 | 3:77e937c315f1 | 130 | positionControl(HAR_HAUT, 630, PLAYTIME, GLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 131 | wait_ms(500); |
| ares1999 | 3:77e937c315f1 | 132 | positionControl_Mul_ensemble(HAR_BASE, 800, PLAYTIME, GLED_ON, HAR_MILIEU, 110, GLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 133 | wait_ms(TEMPO_LONGUE); |
| ares1999 | 3:77e937c315f1 | 134 | //Pré rangement bras haut |
| ares1999 | 3:77e937c315f1 | 135 | positionControl_Mul_ensemble(HAR_BASE, 920, PLAYTIME, RLED_ON, HAR_MILIEU, 70, RLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 136 | positionControl(HAR_HAUT, 650, PLAYTIME, RLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 137 | |
| ares1999 | 3:77e937c315f1 | 138 | //Pré rangement bras bas |
| ares1999 | 3:77e937c315f1 | 139 | positionControl_Mul_ensemble(BAR_BASE, 520, PLAYTIME, RLED_ON, BAR_MILIEU, 160, RLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 140 | positionControl(BAR_HAUT, 750, PLAYTIME, RLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 141 | wait_ms(TEMPO_LONGUE); |
| ares1999 | 3:77e937c315f1 | 142 | //Rangement bras bas |
| ares1999 | 3:77e937c315f1 | 143 | positionControl_Mul_ensemble(BAR_HAUT, 750, PLAYTIME, RLED_ON, BAR_MILIEU, 160, RLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 144 | positionControl(BAR_BASE, 1000, PLAYTIME, RLED_ON, serial_select); |
| ares1999 | 3:77e937c315f1 | 145 | wait_ms(TEMPO); |
| ares1999 | 3:77e937c315f1 | 146 | } |
| ares1999 | 3:77e937c315f1 | 147 | |
| ares1999 | 3:77e937c315f1 | 148 | void activer_CN(void) |
| ares1999 | 3:77e937c315f1 | 149 | { |
| ares1999 | 3:77e937c315f1 | 150 | positionControl_Mul_ensemble(CN_GAUCHE, 790, PLAYTIME, RLED_ON, CN_DROITE, 240, RLED_ON, SERIAL_SPECIAL); |
| ares1999 | 3:77e937c315f1 | 151 | wait_ms(TEMPO); |
| ares1999 | 3:77e937c315f1 | 152 | } |
| ares1999 | 3:77e937c315f1 | 153 | |
| ares1999 | 3:77e937c315f1 | 154 | void desactiver_CN(void) |
| ares1999 | 3:77e937c315f1 | 155 | { |
| ares1999 | 3:77e937c315f1 | 156 | positionControl_Mul_ensemble(CN_GAUCHE, 240, PLAYTIME, RLED_ON, CN_DROITE, 790, RLED_ON, SERIAL_SPECIAL); |
| ares1999 | 3:77e937c315f1 | 157 | wait_ms(TEMPO); |
| ares1999 | 2:c7f2e7d8b305 | 158 | } |