Opgeschoonde code voor verslag

Dependencies:   Encoder HIDScope MODSERIAL mbed

Fork of TotalCodegr13V2 by Rianne Bulthuis

Committer:
arunr
Date:
Thu Oct 22 13:11:55 2015 +0000
Revision:
5:b9d5d7311dac
Parent:
4:b4530fb376dd
Child:
6:1597888c9a56
emg in complete programma;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
arunr 0:65ab9f79a4cc 1 #include "mbed.h"
arunr 0:65ab9f79a4cc 2 #include "encoder.h"
arunr 0:65ab9f79a4cc 3 #include "HIDScope.h"
riannebulthuis 1:7d5e6bc2b314 4 #include "QEI.h"
riannebulthuis 1:7d5e6bc2b314 5 #include "MODSERIAL.h"
arunr 0:65ab9f79a4cc 6
arunr 0:65ab9f79a4cc 7 DigitalOut motor1_direction(D4);
arunr 0:65ab9f79a4cc 8 PwmOut motor1_speed(D5);
arunr 0:65ab9f79a4cc 9 PwmOut led(D9);
arunr 0:65ab9f79a4cc 10 DigitalIn button_1(PTC6); //counterclockwise
arunr 0:65ab9f79a4cc 11 DigitalIn button_2(PTA4); //clockwise
arunr 5:b9d5d7311dac 12 AnalogIn PotMeter1(A5);
arunr 5:b9d5d7311dac 13 AnalogIn EMG(A0);
arunr 5:b9d5d7311dac 14 //AnalogIn EMG_bicepsright (A1);
arunr 5:b9d5d7311dac 15 //AnalogIn EMG_legleft (A2);
arunr 5:b9d5d7311dac 16 //AnalogIn EMG_legright (A3);
arunr 5:b9d5d7311dac 17 Ticker controller;
arunr 5:b9d5d7311dac 18 Ticker ticker_regelaar;
arunr 5:b9d5d7311dac 19 Ticker EMG_Control;
arunr 5:b9d5d7311dac 20 //Timer Timer_Calibration;
arunr 0:65ab9f79a4cc 21 Encoder motor1(D12,D13);
arunr 5:b9d5d7311dac 22 HIDScope scope(3);
arunr 0:65ab9f79a4cc 23
riannebulthuis 2:866a8a9f2b93 24 MODSERIAL pc(USBTX, USBRX);
riannebulthuis 2:866a8a9f2b93 25 volatile bool regelaar_ticker_flag;
riannebulthuis 2:866a8a9f2b93 26
riannebulthuis 2:866a8a9f2b93 27 void setregelaar_ticker_flag()
riannebulthuis 2:866a8a9f2b93 28 {
riannebulthuis 2:866a8a9f2b93 29 regelaar_ticker_flag = true;
riannebulthuis 2:866a8a9f2b93 30 }
riannebulthuis 2:866a8a9f2b93 31
riannebulthuis 2:866a8a9f2b93 32 #define SAMPLETIME_REGELAAR 0.005
riannebulthuis 2:866a8a9f2b93 33
riannebulthuis 2:866a8a9f2b93 34 //define states
arunr 5:b9d5d7311dac 35 enum state {HOME, CALIBRATIE, MOVE_MOTOR, BACKTOHOMEPOSITION, STOP};
arunr 4:b4530fb376dd 36 uint8_t state = HOME;
arunr 0:65ab9f79a4cc 37
riannebulthuis 3:5f59cbe53d7d 38 // Berekening van de output shaft resolution. Het aantal counts per 1 graden verandering
riannebulthuis 3:5f59cbe53d7d 39 const double g = 360; // Aantal graden 1 rotatie
riannebulthuis 3:5f59cbe53d7d 40 const double c = 4200; // Aantal counts 1 rotatie
riannebulthuis 3:5f59cbe53d7d 41 const double q = c/(g);
riannebulthuis 3:5f59cbe53d7d 42
riannebulthuis 3:5f59cbe53d7d 43 //PI-controller constante
riannebulthuis 3:5f59cbe53d7d 44 const double motor1_Kp = 2.0; // Dit is de proportionele gain motor 1
riannebulthuis 3:5f59cbe53d7d 45 const double motor1_Ki = 0.002; // Integrating gain m1.
riannebulthuis 3:5f59cbe53d7d 46 const double motor1_Ts = 0.01; // Time step m1
riannebulthuis 3:5f59cbe53d7d 47 double err_int_m1 = 0 ; // De integrating error op het beginstijdstip m1
riannebulthuis 3:5f59cbe53d7d 48
riannebulthuis 3:5f59cbe53d7d 49 // Reusable P controller
riannebulthuis 3:5f59cbe53d7d 50 double Pc (double error, const double Kp)
riannebulthuis 3:5f59cbe53d7d 51 {
riannebulthuis 3:5f59cbe53d7d 52 return motor1_Kp * error;
riannebulthuis 3:5f59cbe53d7d 53 }
riannebulthuis 3:5f59cbe53d7d 54
riannebulthuis 3:5f59cbe53d7d 55 // Measure the error and apply output to the plant
riannebulthuis 3:5f59cbe53d7d 56 void motor1_controlP()
riannebulthuis 3:5f59cbe53d7d 57 {
riannebulthuis 3:5f59cbe53d7d 58 double referenceP1 = PotMeter1.read();
riannebulthuis 3:5f59cbe53d7d 59 double positionP1 = q*motor1.getPosition();
riannebulthuis 3:5f59cbe53d7d 60 double motorP1 = Pc(referenceP1 - positionP1, motor1_Kp);
riannebulthuis 3:5f59cbe53d7d 61 }
riannebulthuis 3:5f59cbe53d7d 62
riannebulthuis 3:5f59cbe53d7d 63 // Reusable PI controller
riannebulthuis 3:5f59cbe53d7d 64 double PI (double error, const double Kp, const double Ki, const double Ts, double &err_int)
riannebulthuis 3:5f59cbe53d7d 65 {
riannebulthuis 3:5f59cbe53d7d 66 err_int = err_int * Ts*error; // Dit is de fout die er door de integrator uit wordt gehaald. Deze wordt elke meting aangepast door het &-teken
riannebulthuis 3:5f59cbe53d7d 67 return motor1_Kp*error + motor1_Ki*err_int;
riannebulthuis 3:5f59cbe53d7d 68 } // De totale fout die wordt hersteld met behulp van PI control.
riannebulthuis 3:5f59cbe53d7d 69
arunr 5:b9d5d7311dac 70 //bool Cali = false;
arunr 5:b9d5d7311dac 71 //double TimeCali = 5;
arunr 5:b9d5d7311dac 72
arunr 5:b9d5d7311dac 73 // Filter1 = High pass filter tot 20 Hz
arunr 5:b9d5d7311dac 74 double fh1_v1=0, fh1_v2=0, fh2_v1=0, fh2_v2=0;
arunr 5:b9d5d7311dac 75 const double fh1_a1=-0.84909054461, fh1_a2=0.00000000000, fh1_b0= 1, fh1_b1=-1, fh1_b2=0;
arunr 5:b9d5d7311dac 76 const double fh2_a1=-1.82553264091, fh2_a2=0.85001416809, fh2_b0= 1, fh2_b1=-2, fh2_b2=1;
arunr 5:b9d5d7311dac 77 // Filter2 = Low pass filter na 60 Hz
arunr 5:b9d5d7311dac 78 double fl1_v1=0, fl1_v2=0, fl2_v1=0, fl2_v2=0;
arunr 5:b9d5d7311dac 79 const double fl1_a1=-0.66979455390, fl1_a2=0.00000000000, fl1_b0= 1, fl1_b1=1, fl1_b2=0;
arunr 5:b9d5d7311dac 80 const double fl2_a1=-1.55376616139, fl2_a2=0.68023470431, fl2_b0= 1, fl2_b1=2, fl2_b2=1;
arunr 5:b9d5d7311dac 81 // Filter3 = Notch filter at 50 Hz
arunr 5:b9d5d7311dac 82 double fno1_v1=0, fno1_v2=0, fno2_v1=0, fno2_v2=0, fno3_v1=0, fno3_v2=0;
arunr 5:b9d5d7311dac 83 const double fno1_a1 = -1.87934916386, fno1_a2= 0.97731851355, fno1_b0= 1, fno1_b1= -1.90090686046, fno1_b2= 1;
arunr 5:b9d5d7311dac 84 const double fno2_a1 = -1.88341028603, fno2_a2= 0.98825147717, fno2_b0= 1, fno2_b1= -1.90090686046, fno2_b2= 1;
arunr 5:b9d5d7311dac 85 const double fno3_a1 = -1.89635403726, fno3_a2= 0.98894004849, fno3_b0= 1, fno3_b1= -1.90090686046, fno3_b2= 1;
arunr 5:b9d5d7311dac 86
arunr 5:b9d5d7311dac 87 // Filter4 = Lowpass filter at 5 Hz
arunr 5:b9d5d7311dac 88 double flp1_v1=0, flp1_v2=0, flp2_v1=0, flp2_v2=0;
arunr 5:b9d5d7311dac 89 const double flp1_a1=-0.97922725527, flp1_a2=0.00000000000, flp1_b0= 1, flp1_b1=1, flp1_b2=0;
arunr 5:b9d5d7311dac 90 const double flp2_a1=-1.97879353121, flp2_a2=0.97922951943, flp2_b0= 1, flp2_b1=2, flp2_b2=1;
arunr 5:b9d5d7311dac 91
arunr 5:b9d5d7311dac 92 double y1, y2, y3, y4, y5, y6, y7, y8, y9, u1, u2, u3, u4, u5, u6, u7, u8, u9;
arunr 5:b9d5d7311dac 93 double final_filter1;
arunr 5:b9d5d7311dac 94
arunr 5:b9d5d7311dac 95 // Standaard formule voor het biquad filter
arunr 5:b9d5d7311dac 96 double biquad(double u, double &v1, double &v2, const double a1, const double a2, const double b0, const double b1, const double b2)
arunr 5:b9d5d7311dac 97
arunr 5:b9d5d7311dac 98 {
arunr 5:b9d5d7311dac 99 double v = u - a1*v1 - a2*v2;
arunr 5:b9d5d7311dac 100 double y = b0*v + b1*v1 + b2*v2;
arunr 5:b9d5d7311dac 101 v2=v1;
arunr 5:b9d5d7311dac 102 v1=v;
arunr 5:b9d5d7311dac 103 return y;
arunr 5:b9d5d7311dac 104 }
arunr 5:b9d5d7311dac 105
arunr 5:b9d5d7311dac 106 void Filters()
arunr 5:b9d5d7311dac 107 {
arunr 5:b9d5d7311dac 108 u1 = EMG.read();
arunr 5:b9d5d7311dac 109 //Highpass
arunr 5:b9d5d7311dac 110 y1 = biquad (u1, fh1_v1, fh1_v2, fh1_a1, fh1_a2, fh1_b0*0.924547, fh1_b1*0.924547, fh1_b2*0.924547);
arunr 5:b9d5d7311dac 111 u2 = y1;
arunr 5:b9d5d7311dac 112 y2 = biquad (u2, fh2_v1, fh2_v2, fh2_a1, fh2_a2, fh2_b0*0.918885, fh2_b1*0.918885, fh2_b2*0.918885);
arunr 5:b9d5d7311dac 113 //Lowpass
arunr 5:b9d5d7311dac 114 u3 = y2;
arunr 5:b9d5d7311dac 115 y3 = biquad (u3, fl1_v1, fl1_v2, fl1_a1, fl1_a2, fl1_b0*0.165103, fl1_b1*0.165103, fl1_b2*0.165103);
arunr 5:b9d5d7311dac 116 u4 = y3;
arunr 5:b9d5d7311dac 117 y4 = biquad (u4, fl2_v1, fl2_v2, fl2_a1, fl2_a2, fl2_b0*0.031617, fl2_b1*0.031617, fl2_b2*0.031617);
arunr 5:b9d5d7311dac 118 // Notch
arunr 5:b9d5d7311dac 119 u5 = y4;
arunr 5:b9d5d7311dac 120 y5 = biquad (u5, fno1_v1, fno1_v2, fno1_a1, fno1_a2, fno1_b0*1.004206, fno1_b1*1.004206, fno1_b2*1.004206);
arunr 5:b9d5d7311dac 121 u6 = y5;
arunr 5:b9d5d7311dac 122 y6 = biquad (u6, fno2_v1, fno2_v2, fno2_a1, fno2_a2, fno2_b0, fno2_b1, fno2_b2);
arunr 5:b9d5d7311dac 123 u7 = y6;
arunr 5:b9d5d7311dac 124 y7 = biquad (u7, fno3_v1, fno3_v2, fno3_a1, fno3_a2, fno3_b0*0.973227, fno3_b1*0.973227, fno3_b2*0.973227);
arunr 5:b9d5d7311dac 125 y8 = fabs (y7);
arunr 5:b9d5d7311dac 126 //smooth
arunr 5:b9d5d7311dac 127 u8 = y8;
arunr 5:b9d5d7311dac 128 y9 = biquad (u8, flp1_v1, flp1_v2, flp1_a1, flp1_a2, flp1_b0* 0.010386, flp1_b1* 0.010386, flp1_b2* 0.010386);
arunr 5:b9d5d7311dac 129 u9 = y9;
arunr 5:b9d5d7311dac 130 final_filter1 = biquad(u9, flp2_v1, flp2_v2, flp2_a1, flp2_a2, flp2_b0*0.000109, flp2_b1*0.000109, flp2_b2*0.000109);
arunr 5:b9d5d7311dac 131
arunr 5:b9d5d7311dac 132 scope.set (0, y8);
arunr 5:b9d5d7311dac 133 // scope.set (1, y2);
arunr 5:b9d5d7311dac 134 // scope.set (2, y4);
arunr 5:b9d5d7311dac 135 // scope.set (3, y7);
arunr 5:b9d5d7311dac 136 scope.set (1, final_filter1);
arunr 5:b9d5d7311dac 137 //scope.set (2, final_filter1);
arunr 5:b9d5d7311dac 138 scope.send ();
arunr 5:b9d5d7311dac 139 }
arunr 5:b9d5d7311dac 140
arunr 5:b9d5d7311dac 141
riannebulthuis 3:5f59cbe53d7d 142 void motor1_controlPI()
riannebulthuis 3:5f59cbe53d7d 143 {
riannebulthuis 3:5f59cbe53d7d 144 double referencePI1 = PotMeter1.read();
riannebulthuis 3:5f59cbe53d7d 145 double positionPI1 = q*motor1.getPosition();
riannebulthuis 3:5f59cbe53d7d 146 double motorPI1 = PI(referencePI1 - positionPI1, motor1_Kp, motor1_Ki, motor1_Ts, err_int_m1);
riannebulthuis 3:5f59cbe53d7d 147 }
riannebulthuis 3:5f59cbe53d7d 148
arunr 0:65ab9f79a4cc 149 const int pressed = 0;
arunr 0:65ab9f79a4cc 150
arunr 0:65ab9f79a4cc 151 double H;
arunr 0:65ab9f79a4cc 152 double P;
arunr 0:65ab9f79a4cc 153 double D;
arunr 0:65ab9f79a4cc 154
arunr 0:65ab9f79a4cc 155
arunr 4:b4530fb376dd 156 void gethome(){
arunr 0:65ab9f79a4cc 157 H = motor1.getPosition();
arunr 0:65ab9f79a4cc 158 }
arunr 0:65ab9f79a4cc 159
arunr 0:65ab9f79a4cc 160 void move_motor1_ccw (){
arunr 0:65ab9f79a4cc 161 motor1_direction = 0;
arunr 4:b4530fb376dd 162 motor1_speed = 1;
arunr 0:65ab9f79a4cc 163 }
arunr 0:65ab9f79a4cc 164
arunr 0:65ab9f79a4cc 165 void move_motor1_cw (){
arunr 0:65ab9f79a4cc 166 motor1_direction = 1;
arunr 4:b4530fb376dd 167 motor1_speed = 1;
arunr 0:65ab9f79a4cc 168 }
arunr 0:65ab9f79a4cc 169
arunr 0:65ab9f79a4cc 170 void movetohome(){
arunr 0:65ab9f79a4cc 171 P = motor1.getPosition();
arunr 4:b4530fb376dd 172
arunr 4:b4530fb376dd 173 if (P >= -28 && P <= 28){
arunr 0:65ab9f79a4cc 174 motor1_speed = 0;
arunr 0:65ab9f79a4cc 175 }
arunr 4:b4530fb376dd 176 else if (P > 24){
riannebulthuis 3:5f59cbe53d7d 177 motor1_direction = 1;
riannebulthuis 3:5f59cbe53d7d 178 motor1_speed = 0.1;
arunr 0:65ab9f79a4cc 179 }
arunr 4:b4530fb376dd 180 else if (P < -24){
riannebulthuis 3:5f59cbe53d7d 181 motor1_direction = 0;
riannebulthuis 3:5f59cbe53d7d 182 motor1_speed = 0.1;
arunr 0:65ab9f79a4cc 183 }
arunr 0:65ab9f79a4cc 184 }
arunr 0:65ab9f79a4cc 185
arunr 0:65ab9f79a4cc 186 void move_motor1()
arunr 0:65ab9f79a4cc 187 {
arunr 5:b9d5d7311dac 188 if (final_filter1 > 0.03){
arunr 5:b9d5d7311dac 189 pc.printf("Moving clockwise \n\r");
arunr 5:b9d5d7311dac 190 move_motor1_cw ();
arunr 5:b9d5d7311dac 191 }
arunr 5:b9d5d7311dac 192 else if (button_2 == pressed){
arunr 5:b9d5d7311dac 193 pc.printf("Moving counterclockwise \n\r");
arunr 5:b9d5d7311dac 194 move_motor1_ccw ();
arunr 5:b9d5d7311dac 195 }
arunr 5:b9d5d7311dac 196 else {
arunr 5:b9d5d7311dac 197 pc.printf("Not moving \n\r");
arunr 5:b9d5d7311dac 198 motor1_speed = 0;
arunr 5:b9d5d7311dac 199 }
arunr 0:65ab9f79a4cc 200 }
arunr 0:65ab9f79a4cc 201
arunr 5:b9d5d7311dac 202 //void read_encoder1 () // aflezen van encoder via hidscope??
arunr 5:b9d5d7311dac 203 //{
arunr 5:b9d5d7311dac 204 // scope.set(0,motor1.getPosition());
arunr 5:b9d5d7311dac 205 //led.write(motor1.getPosition()/100.0);
arunr 5:b9d5d7311dac 206 // scope.send();
arunr 5:b9d5d7311dac 207 // wait(0.2f);
arunr 5:b9d5d7311dac 208 //}
arunr 0:65ab9f79a4cc 209
arunr 4:b4530fb376dd 210 void print_position(){
arunr 4:b4530fb376dd 211 pc.printf("move motor \n\r");
arunr 4:b4530fb376dd 212 wait(0.2f);
arunr 4:b4530fb376dd 213 }
arunr 0:65ab9f79a4cc 214 int main()
riannebulthuis 2:866a8a9f2b93 215 {
arunr 0:65ab9f79a4cc 216 while (true) {
riannebulthuis 1:7d5e6bc2b314 217 pc.baud(9600); //pc baud rate van de computer
arunr 5:b9d5d7311dac 218 EMG_Control.attach_us(Filters,1e3);
riannebulthuis 1:7d5e6bc2b314 219
riannebulthuis 1:7d5e6bc2b314 220 switch (state) { //zorgt voor het in goede volgorde uitvoeren van de cases
riannebulthuis 1:7d5e6bc2b314 221
arunr 4:b4530fb376dd 222 case HOME: //positie op 0 zetten voor arm 1
riannebulthuis 1:7d5e6bc2b314 223 {
arunr 4:b4530fb376dd 224 pc.printf("home\n\r");
arunr 5:b9d5d7311dac 225 //read_encoder1();
arunr 4:b4530fb376dd 226 gethome();
arunr 4:b4530fb376dd 227 pc.printf("Home-position is %f\n\r", H);
arunr 5:b9d5d7311dac 228 state = CALIBRATIE;
arunr 4:b4530fb376dd 229 wait(5);
riannebulthuis 1:7d5e6bc2b314 230 break;
riannebulthuis 1:7d5e6bc2b314 231 }
riannebulthuis 1:7d5e6bc2b314 232
arunr 5:b9d5d7311dac 233 //case CALIBRATIE:
arunr 5:b9d5d7311dac 234 //{
arunr 5:b9d5d7311dac 235 //pc.printf("Aanspannen in 10 \n\r");
arunr 5:b9d5d7311dac 236 //wait(10);
arunr 5:b9d5d7311dac 237 //EMG_Control.attach_us(MyController,1e3);
arunr 5:b9d5d7311dac 238 //Timer_Calibration.start();
arunr 5:b9d5d7311dac 239 //if (Timer_Calibration < TimeCali) {
arunr 5:b9d5d7311dac 240 // Cali = true;
arunr 5:b9d5d7311dac 241 // pc.printf("Aanspannen \n\r");
arunr 5:b9d5d7311dac 242 //}
arunr 5:b9d5d7311dac 243 //else {
arunr 5:b9d5d7311dac 244 // Cali = false;
arunr 5:b9d5d7311dac 245 //}
arunr 5:b9d5d7311dac 246 //pc.printf("Stoppen \n\r");
arunr 5:b9d5d7311dac 247 //Timer_Calibration.stop();
arunr 5:b9d5d7311dac 248 //Timer_Calibration.reset();
arunr 5:b9d5d7311dac 249 //state = MOVE_MOTOR;
arunr 5:b9d5d7311dac 250 // break;
arunr 5:b9d5d7311dac 251 //}
arunr 5:b9d5d7311dac 252
riannebulthuis 2:866a8a9f2b93 253 case MOVE_MOTOR: //motor kan cw en ccw bewegen a.d.h.v. buttons
riannebulthuis 1:7d5e6bc2b314 254 {
riannebulthuis 2:866a8a9f2b93 255 pc.printf("move_motor\n\r");
riannebulthuis 2:866a8a9f2b93 256 while (state == MOVE_MOTOR){
riannebulthuis 2:866a8a9f2b93 257 move_motor1();
arunr 4:b4530fb376dd 258 print_position();
riannebulthuis 2:866a8a9f2b93 259 if (button_1 == pressed && button_2 == pressed){
riannebulthuis 2:866a8a9f2b93 260 state = BACKTOHOMEPOSITION;
riannebulthuis 2:866a8a9f2b93 261 }
riannebulthuis 2:866a8a9f2b93 262 }
riannebulthuis 2:866a8a9f2b93 263 wait (1);
riannebulthuis 2:866a8a9f2b93 264 break;
riannebulthuis 1:7d5e6bc2b314 265 }
riannebulthuis 1:7d5e6bc2b314 266
riannebulthuis 2:866a8a9f2b93 267 case BACKTOHOMEPOSITION: //motor gaat terug naar homeposition
riannebulthuis 1:7d5e6bc2b314 268 {
riannebulthuis 2:866a8a9f2b93 269 pc.printf("backhomeposition\n\r");
riannebulthuis 2:866a8a9f2b93 270 wait (1);
riannebulthuis 2:866a8a9f2b93 271
riannebulthuis 2:866a8a9f2b93 272 ticker_regelaar.attach(setregelaar_ticker_flag, SAMPLETIME_REGELAAR);
arunr 5:b9d5d7311dac 273 //EMG_Control.attach_us(Filters,1e3);
arunr 5:b9d5d7311dac 274
riannebulthuis 2:866a8a9f2b93 275 while(state == BACKTOHOMEPOSITION){
riannebulthuis 3:5f59cbe53d7d 276 movetohome();
riannebulthuis 2:866a8a9f2b93 277 while(regelaar_ticker_flag != true);
riannebulthuis 2:866a8a9f2b93 278 regelaar_ticker_flag = false;
riannebulthuis 2:866a8a9f2b93 279
riannebulthuis 2:866a8a9f2b93 280 pc.printf("pulsmotorposition1 %d", motor1.getPosition());
arunr 4:b4530fb376dd 281 pc.printf("referentie %f\n\r", H);
riannebulthuis 2:866a8a9f2b93 282
arunr 4:b4530fb376dd 283 if (P <=24 && P >= -24){
arunr 4:b4530fb376dd 284 pc.printf("pulsmotorposition1 %d", motor1.getPosition());
arunr 4:b4530fb376dd 285 pc.printf("referentie %f\n\r", H);
riannebulthuis 3:5f59cbe53d7d 286 state = STOP;
arunr 4:b4530fb376dd 287 pc.printf("Laatste positie %f\n\r", motor1.getPosition());
riannebulthuis 3:5f59cbe53d7d 288 break;
riannebulthuis 2:866a8a9f2b93 289 }
riannebulthuis 3:5f59cbe53d7d 290 }
riannebulthuis 3:5f59cbe53d7d 291 }
riannebulthuis 3:5f59cbe53d7d 292 case STOP:
riannebulthuis 3:5f59cbe53d7d 293 {
arunr 4:b4530fb376dd 294 static int c;
riannebulthuis 3:5f59cbe53d7d 295 while(state == STOP){
riannebulthuis 3:5f59cbe53d7d 296 motor1_speed = 0;
arunr 4:b4530fb376dd 297 if (c++ == 0){
riannebulthuis 3:5f59cbe53d7d 298 pc.printf("einde\n\r");
riannebulthuis 3:5f59cbe53d7d 299 }
riannebulthuis 3:5f59cbe53d7d 300 }
riannebulthuis 1:7d5e6bc2b314 301 break;
riannebulthuis 3:5f59cbe53d7d 302 }
riannebulthuis 3:5f59cbe53d7d 303 }
riannebulthuis 2:866a8a9f2b93 304 }
arunr 0:65ab9f79a4cc 305 }