Group 9 BioRobotics / Mbed 2 deprecated the_code

Dependencies:   HIDScope Servo mbed QEI biquadFilter

Committer:
s1725696
Date:
Fri Oct 26 09:40:09 2018 +0000
Revision:
9:d7a6a3619576
Parent:
8:5ad8a7892693
Child:
10:56136a0da8c1
Minor changes in switch;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
s1725696 5:3581013d4505 1 #include "mbed.h" // Use revision 119!!
s1725696 5:3581013d4505 2 #include "HIDScope.h" // For displaying data, select MBED - HID device, restart for every new code
s1725696 5:3581013d4505 3 #include "QEI.h" // For reading the encoder of the motors
s1725696 9:d7a6a3619576 4 #include <ctime> // for the timer during the process (if needed)
s1725696 0:cb8857cf3ea4 5
s1725696 5:3581013d4505 6 #define SERIAL_BAUD 115200
s1725696 5:3581013d4505 7
s1725696 5:3581013d4505 8 // In- en outputs
s1725696 4:8183e7b228f0 9 // -----------------------------------------------------------------------------
s1725696 4:8183e7b228f0 10
s1725696 5:3581013d4505 11 /*
s1725696 0:cb8857cf3ea4 12 // EMG related
s1725696 5:3581013d4505 13 AnalogIn emg1(); // EMG signal 1
s1725696 5:3581013d4505 14 AnalogIn emg2(); // EMG signal 2
s1725696 5:3581013d4505 15 // if needed
s1725696 5:3581013d4505 16 AnalogIn emg3(); // EMG signal 3
s1725696 5:3581013d4505 17 AnalogIn emg4(); // EMG signal 4
s1725696 0:cb8857cf3ea4 18 */
s1725696 0:cb8857cf3ea4 19
s1725696 0:cb8857cf3ea4 20 // Motor related
s1725696 0:cb8857cf3ea4 21 DigitalOut dirpin_1(D4); // direction of motor 1
s1725696 0:cb8857cf3ea4 22 PwmOut pwmpin_1(D5); // PWM pin of motor 1
s1725696 5:3581013d4505 23 DigitalOut dirpin_2(D7); // direction of motor 2
s1725696 5:3581013d4505 24 PwmOut pwmpin_2(D6); // PWM pin of motor 2
s1725696 0:cb8857cf3ea4 25
s1725696 0:cb8857cf3ea4 26 // Extra stuff
s1725696 0:cb8857cf3ea4 27 // Like LED lights, buttons etc
s1725696 9:d7a6a3619576 28
s1725696 9:d7a6a3619576 29 DigitalIn button_motorcal(SW2); // button for motor calibration, on mbed
s1725696 8:5ad8a7892693 30 DigitalIn button_emergency(D7); // button for emergency mode, on bioshield
s1725696 9:d7a6a3619576 31 DigitalIn button_wait(SW3); // button for wait mode, on mbed
s1725696 8:5ad8a7892693 32 DigitalIn button_demo(D6); // button for demo mode, on bioshield
s1725696 9:d7a6a3619576 33
s1725696 4:8183e7b228f0 34 DigitalIn led_red(LED_RED); // red led
s1725696 4:8183e7b228f0 35 DigitalIn led_green(LED_GREEN); // green led
s1725696 4:8183e7b228f0 36 DigitalIn led_blue(LED_BLUE); // blue led
s1725696 9:d7a6a3619576 37
s1725696 5:3581013d4505 38 AnalogIn pot_1(A1); // potmeter for simulating EMG input
s1725696 5:3581013d4505 39
s1725696 0:cb8857cf3ea4 40
s1725696 0:cb8857cf3ea4 41 // Other stuff
s1725696 4:8183e7b228f0 42 // -----------------------------------------------------------------------------
s1725696 0:cb8857cf3ea4 43 // Define stuff like tickers etc
s1725696 0:cb8857cf3ea4 44
s1725696 9:d7a6a3619576 45 Ticker NAME; // Name a ticker, use each ticker only for 1 function!
s1725696 0:cb8857cf3ea4 46 HIDScope scope(2); // Number of channels in HIDScope
s1725696 0:cb8857cf3ea4 47 QEI Encoder(D13,D12,NC,64,QEI::X4_ENCODING); // Define the type of encoding: X4 encoding(default is X2)
s1725696 5:3581013d4505 48 Serial pc(USBTX,USBRX);
s1725696 6:f495a77c2c95 49 Timer t; // For timing the time in each state (https://os.mbed.com/handbook/Timer)
s1725696 0:cb8857cf3ea4 50
s1725696 0:cb8857cf3ea4 51 // Variables
s1725696 4:8183e7b228f0 52 // -----------------------------------------------------------------------------
s1725696 0:cb8857cf3ea4 53 // Define here all variables needed throughout the whole code
s1725696 5:3581013d4505 54 int counts;
s1725696 6:f495a77c2c95 55 float potmeter_value;
s1725696 9:d7a6a3619576 56 double time_overall;
s1725696 6:f495a77c2c95 57 float time_in_state;
s1725696 9:d7a6a3619576 58 double motor_velocity = 0;
s1725696 9:d7a6a3619576 59 double EMG = 0;
s1725696 9:d7a6a3619576 60 double errors = 0;
s1725696 6:f495a77c2c95 61
s1725696 6:f495a77c2c95 62 // states
s1725696 9:d7a6a3619576 63 enum states {WAIT, MOTOR_CAL, EMG_CAL, START, OPERATING, FAILURE, DEMO}; // states the robot can be in
s1725696 7:ec5add330cb3 64 states CurrentState = WAIT; // the CurrentState to start with is the WAIT state
s1725696 6:f495a77c2c95 65 bool StateChanged = true; // the state must be changed to go into the next state
s1725696 0:cb8857cf3ea4 66
s1725696 0:cb8857cf3ea4 67 // Functions
s1725696 4:8183e7b228f0 68 // -----------------------------------------------------------------------------
s1725696 0:cb8857cf3ea4 69
s1725696 4:8183e7b228f0 70 // Encoder
s1725696 4:8183e7b228f0 71 // Getting encoder information from motors
s1725696 4:8183e7b228f0 72 int encoder()
s1725696 4:8183e7b228f0 73 {
s1725696 5:3581013d4505 74 int counts = Encoder.getPulses();
s1725696 4:8183e7b228f0 75 return counts;
s1725696 5:3581013d4505 76 }
s1725696 5:3581013d4505 77
s1725696 5:3581013d4505 78 // potmeter
s1725696 5:3581013d4505 79 float potmeter()
s1725696 5:3581013d4505 80 {
s1725696 5:3581013d4505 81 float out_1 = pot_1 * 2.0f;
s1725696 5:3581013d4505 82 float out_2 = out_1 - 1.0f;
s1725696 5:3581013d4505 83
s1725696 5:3581013d4505 84 dirpin_1.write(out_2 < 0);
s1725696 5:3581013d4505 85 dirpin_2.write(out_2 < 0);
s1725696 5:3581013d4505 86
s1725696 5:3581013d4505 87 pwmpin_1 = fabs (out_2); // Has to be positive value
s1725696 5:3581013d4505 88 pwmpin_2 = fabs (out_2);
s1725696 5:3581013d4505 89
s1725696 5:3581013d4505 90 return out_2;
s1725696 6:f495a77c2c95 91 }
s1725696 9:d7a6a3619576 92
s1725696 9:d7a6a3619576 93 // EMG filter
s1725696 9:d7a6a3619576 94 // To process the EMG signal before information can be caught from it
s1725696 9:d7a6a3619576 95 // Kees mee bezig
s1725696 4:8183e7b228f0 96
s1725696 0:cb8857cf3ea4 97 // Motor calibration
s1725696 0:cb8857cf3ea4 98 // To calibrate the motor angle to some mechanical boundaries
s1725696 4:8183e7b228f0 99 // Kenneth mee bezig
s1725696 0:cb8857cf3ea4 100
s1725696 0:cb8857cf3ea4 101 // EMG calibration
s1725696 0:cb8857cf3ea4 102 // To calibrate the EMG signal to some boundary values
s1725696 6:f495a77c2c95 103 // Simon mee bezig
s1725696 0:cb8857cf3ea4 104
s1725696 9:d7a6a3619576 105 // Send information to HIDScope
s1725696 6:f495a77c2c95 106 void hidscope() // Attach this to a ticker!
s1725696 0:cb8857cf3ea4 107 {
s1725696 6:f495a77c2c95 108 scope.set(0, counts); // send EMG 1 to channel 1 (=0)
s1725696 6:f495a77c2c95 109 scope.set(1, potmeter_value); // sent EMG 2 to channel 2 (=1)
s1725696 5:3581013d4505 110
s1725696 1:1a8211e1f3f3 111 // Ensure that enough channels are available (HIDScope scope(2))
s1725696 0:cb8857cf3ea4 112 scope.send(); // Send all channels to the PC at once
s1725696 6:f495a77c2c95 113 }
s1725696 9:d7a6a3619576 114
s1725696 9:d7a6a3619576 115 // PID controller
s1725696 9:d7a6a3619576 116 // To control the input signal before it goes into the motor control
s1725696 9:d7a6a3619576 117 // Simon mee bezig
s1725696 0:cb8857cf3ea4 118
s1725696 0:cb8857cf3ea4 119 // Start
s1725696 0:cb8857cf3ea4 120 // To move the robot to the starting position: middle
s1725696 4:8183e7b228f0 121 void start()
s1725696 4:8183e7b228f0 122 {
s1725696 4:8183e7b228f0 123 // move to middle
s1725696 4:8183e7b228f0 124 }
s1725696 0:cb8857cf3ea4 125
s1725696 0:cb8857cf3ea4 126 // Operating mode
s1725696 0:cb8857cf3ea4 127 // To control the robot with EMG signals
s1725696 6:f495a77c2c95 128 // Gertjan bezig met motor aansturen
s1725696 0:cb8857cf3ea4 129
s1725696 0:cb8857cf3ea4 130 // Demo mode
s1725696 0:cb8857cf3ea4 131 // To control the robot with a written code and write 'HELLO'
s1725696 4:8183e7b228f0 132 // Voor het laatst bewaren
s1725696 0:cb8857cf3ea4 133
s1725696 0:cb8857cf3ea4 134 // Emergency mode
s1725696 0:cb8857cf3ea4 135 // To shut down the robot after an error etc
s1725696 0:cb8857cf3ea4 136
s1725696 0:cb8857cf3ea4 137 // Main function
s1725696 4:8183e7b228f0 138 // -----------------------------------------------------------------------------
s1725696 0:cb8857cf3ea4 139 int main()
s1725696 0:cb8857cf3ea4 140 {
s1725696 0:cb8857cf3ea4 141 pc.baud(115200); // For TeraTerm, the baudrate, set also in TeraTerm itself!
s1725696 0:cb8857cf3ea4 142 pc.printf("Start code\r\n"); // To check if the program starts
s1725696 9:d7a6a3619576 143 pwmpin_1.period_us(60); // Setting period for PWM
s1725696 9:d7a6a3619576 144 NAME.attach(&hidscope,0.002f); // Send information to HIDScope
s1725696 1:1a8211e1f3f3 145
s1725696 1:1a8211e1f3f3 146 while(true){
s1725696 6:f495a77c2c95 147 // timer
s1725696 6:f495a77c2c95 148 clock_t start; // start the timer
s1725696 6:f495a77c2c95 149 start = clock();
s1725696 9:d7a6a3619576 150 time_overall = (clock() - start) / (double) CLOCKS_PER_SEC;
s1725696 5:3581013d4505 151
s1725696 5:3581013d4505 152 counts = encoder();
s1725696 6:f495a77c2c95 153 potmeter_value = potmeter();
s1725696 6:f495a77c2c95 154
s1725696 5:3581013d4505 155
s1725696 6:f495a77c2c95 156 //pc.printf("potmeter value = %f ", potmeter_value);
s1725696 6:f495a77c2c95 157 //pc.printf("counts = %i\r\n", counts);
s1725696 5:3581013d4505 158
s1725696 6:f495a77c2c95 159 // With the help of a switch loop and states we can switch between states and the robot knows what to do
s1725696 9:d7a6a3619576 160 switch(CurrentState)
s1725696 6:f495a77c2c95 161 {
s1725696 6:f495a77c2c95 162 case WAIT:
s1725696 6:f495a77c2c95 163
s1725696 6:f495a77c2c95 164 if(StateChanged) // so if StateChanged is true
s1725696 6:f495a77c2c95 165 {
s1725696 6:f495a77c2c95 166 // Execute WAIT mode
s1725696 6:f495a77c2c95 167 pc.printf("State is WAIT\r\n");
s1725696 6:f495a77c2c95 168 StateChanged = false; // the state is still WAIT
s1725696 6:f495a77c2c95 169 }
s1725696 6:f495a77c2c95 170
s1725696 7:ec5add330cb3 171 if(button_motorcal == true) // condition for WAIT --> MOTOR_CAl; button_motorcal press
s1725696 6:f495a77c2c95 172 {
s1725696 6:f495a77c2c95 173 CurrentState = MOTOR_CAL;
s1725696 9:d7a6a3619576 174 pc.printf("State is MOTOR_CAL\r\n");
s1725696 6:f495a77c2c95 175 StateChanged = true;
s1725696 6:f495a77c2c95 176 }
s1725696 7:ec5add330cb3 177
s1725696 7:ec5add330cb3 178 if (button_emergency == true) // condition for WAIT --> FAILURE; button_emergency press
s1725696 7:ec5add330cb3 179 {
s1725696 7:ec5add330cb3 180 CurrentState = FAILURE;
s1725696 9:d7a6a3619576 181 pc.printf("State is FAILURE\r\n");
s1725696 7:ec5add330cb3 182 StateChanged = true;
s1725696 7:ec5add330cb3 183 }
s1725696 6:f495a77c2c95 184
s1725696 6:f495a77c2c95 185 break;
s1725696 6:f495a77c2c95 186
s1725696 6:f495a77c2c95 187 case MOTOR_CAL:
s1725696 6:f495a77c2c95 188
s1725696 6:f495a77c2c95 189 if(StateChanged) // so if StateChanged is true
s1725696 6:f495a77c2c95 190 {
s1725696 9:d7a6a3619576 191 t.reset();
s1725696 6:f495a77c2c95 192 t.start();
s1725696 6:f495a77c2c95 193 // Execute MOTOR_CAL mode
s1725696 6:f495a77c2c95 194 t.stop();
s1725696 6:f495a77c2c95 195 time_in_state = t.read();
s1725696 9:d7a6a3619576 196 pc.printf("Time here = %f\r\n", time_in_state);
s1725696 6:f495a77c2c95 197 StateChanged = false; // the state is still MOTOR_CAL
s1725696 6:f495a77c2c95 198 }
s1725696 6:f495a77c2c95 199
s1725696 9:d7a6a3619576 200 if((time_in_state > 3.0) && (motor_velocity < 0.01)) // condition for MOTOR_CAL --> EMG_CAL; 3s en motors stopped moving
s1725696 6:f495a77c2c95 201 {
s1725696 6:f495a77c2c95 202 CurrentState = EMG_CAL;
s1725696 9:d7a6a3619576 203 pc.printf("State is EMG_CAL\r\n");
s1725696 6:f495a77c2c95 204 StateChanged = true;
s1725696 6:f495a77c2c95 205 }
s1725696 6:f495a77c2c95 206
s1725696 7:ec5add330cb3 207 if (button_emergency == true) // condition for MOTOR_CAL --> FAILURE; button_emergency press
s1725696 7:ec5add330cb3 208 {
s1725696 7:ec5add330cb3 209 CurrentState = FAILURE;
s1725696 9:d7a6a3619576 210 pc.printf("State is FAILURE\r\n");
s1725696 7:ec5add330cb3 211 StateChanged = true;
s1725696 7:ec5add330cb3 212 }
s1725696 7:ec5add330cb3 213
s1725696 6:f495a77c2c95 214 break;
s1725696 6:f495a77c2c95 215
s1725696 6:f495a77c2c95 216 case EMG_CAL:
s1725696 6:f495a77c2c95 217
s1725696 6:f495a77c2c95 218 if(StateChanged) // so if StateChanged is true
s1725696 6:f495a77c2c95 219 {
s1725696 6:f495a77c2c95 220 t.reset();
s1725696 6:f495a77c2c95 221 t.start();
s1725696 6:f495a77c2c95 222 // Execute EMG_CAL mode
s1725696 6:f495a77c2c95 223 t.stop();
s1725696 6:f495a77c2c95 224 time_in_state = t.read();
s1725696 9:d7a6a3619576 225 pc.printf("Time here = %f\r\n", time_in_state);
s1725696 6:f495a77c2c95 226 StateChanged = false; // state is still EMG_CAL
s1725696 6:f495a77c2c95 227 }
s1725696 6:f495a77c2c95 228
s1725696 9:d7a6a3619576 229 if((time_in_state > 5) && (EMG < 0.01)) // condition for EMG_CAL --> START; 5s and EMG is low
s1725696 6:f495a77c2c95 230 {
s1725696 6:f495a77c2c95 231 CurrentState = START;
s1725696 9:d7a6a3619576 232 pc.printf("State is START\r\n");
s1725696 6:f495a77c2c95 233 StateChanged = true;
s1725696 6:f495a77c2c95 234 }
s1725696 6:f495a77c2c95 235
s1725696 7:ec5add330cb3 236 if (button_emergency == true) // condition for EMG_CAL --> FAILURE; button_emergency press
s1725696 7:ec5add330cb3 237 {
s1725696 7:ec5add330cb3 238 CurrentState = FAILURE;
s1725696 9:d7a6a3619576 239 pc.printf("State is FAILURE\r\n");
s1725696 7:ec5add330cb3 240 StateChanged = true;
s1725696 7:ec5add330cb3 241 }
s1725696 7:ec5add330cb3 242
s1725696 6:f495a77c2c95 243 break;
s1725696 6:f495a77c2c95 244
s1725696 6:f495a77c2c95 245 case START:
s1725696 6:f495a77c2c95 246
s1725696 6:f495a77c2c95 247 if(StateChanged) // so if StateChanged is true
s1725696 6:f495a77c2c95 248 {
s1725696 6:f495a77c2c95 249 t.reset();
s1725696 6:f495a77c2c95 250 t.start();
s1725696 6:f495a77c2c95 251 // Execute START mode
s1725696 6:f495a77c2c95 252 t.stop();
s1725696 6:f495a77c2c95 253 time_in_state = t.read();
s1725696 9:d7a6a3619576 254 pc.printf("Time here = %f\r\n", time_in_state);
s1725696 6:f495a77c2c95 255 StateChanged = false; // state is still START
s1725696 6:f495a77c2c95 256 }
s1725696 6:f495a77c2c95 257
s1725696 9:d7a6a3619576 258 if((time_in_state > 5) && (errors < 0.01)) // condition for START --> OPERATING; 5s and error is small
s1725696 6:f495a77c2c95 259 {
s1725696 6:f495a77c2c95 260 CurrentState = OPERATING;
s1725696 9:d7a6a3619576 261 pc.printf("State is OPERATING\r\n");
s1725696 6:f495a77c2c95 262 StateChanged = true;
s1725696 6:f495a77c2c95 263 }
s1725696 6:f495a77c2c95 264
s1725696 7:ec5add330cb3 265 if (button_emergency == true) // condition for START --> FAILURE; button_emergency press
s1725696 7:ec5add330cb3 266 {
s1725696 7:ec5add330cb3 267 CurrentState = FAILURE;
s1725696 9:d7a6a3619576 268 pc.printf("State is FAILURE\r\n");
s1725696 7:ec5add330cb3 269 StateChanged = true;
s1725696 7:ec5add330cb3 270 }
s1725696 7:ec5add330cb3 271
s1725696 6:f495a77c2c95 272 break;
s1725696 6:f495a77c2c95 273
s1725696 6:f495a77c2c95 274 case OPERATING:
s1725696 6:f495a77c2c95 275
s1725696 6:f495a77c2c95 276 if(StateChanged) // so if StateChanged is true
s1725696 6:f495a77c2c95 277 {
s1725696 6:f495a77c2c95 278 // Execute OPERATING mode
s1725696 6:f495a77c2c95 279 pc.printf("State is OPERATING\r\n");
s1725696 6:f495a77c2c95 280 StateChanged = false; // state is still OPERATING
s1725696 6:f495a77c2c95 281 }
s1725696 6:f495a77c2c95 282
s1725696 7:ec5add330cb3 283 if(button_emergency == true) // condition for OPERATING --> FAILURE; button_emergency press
s1725696 6:f495a77c2c95 284 {
s1725696 6:f495a77c2c95 285 CurrentState = FAILURE;
s1725696 9:d7a6a3619576 286 pc.printf("State is FAILURE\r\n");
s1725696 6:f495a77c2c95 287 StateChanged = true;
s1725696 6:f495a77c2c95 288 }
s1725696 6:f495a77c2c95 289
s1725696 7:ec5add330cb3 290 if(button_demo == true) // condition for OPERATING --> DEMO; button_demo press
s1725696 6:f495a77c2c95 291 {
s1725696 6:f495a77c2c95 292 CurrentState = DEMO;
s1725696 9:d7a6a3619576 293 pc.printf("State is DEMO\r\n");
s1725696 9:d7a6a3619576 294 StateChanged = true;
s1725696 9:d7a6a3619576 295 }
s1725696 9:d7a6a3619576 296
s1725696 9:d7a6a3619576 297 if(button_wait == true) // condition OPERATING --> WAIT; button_wait press
s1725696 9:d7a6a3619576 298 {
s1725696 9:d7a6a3619576 299 CurrentState = WAIT;
s1725696 9:d7a6a3619576 300 pc.printf("State is WAIT\r\n");
s1725696 6:f495a77c2c95 301 StateChanged = true;
s1725696 6:f495a77c2c95 302 }
s1725696 6:f495a77c2c95 303
s1725696 6:f495a77c2c95 304 break;
s1725696 6:f495a77c2c95 305
s1725696 6:f495a77c2c95 306 case FAILURE:
s1725696 6:f495a77c2c95 307
s1725696 6:f495a77c2c95 308 if(StateChanged) // so if StateChanged is true
s1725696 6:f495a77c2c95 309 {
s1725696 6:f495a77c2c95 310 // Execute FAILURE mode
s1725696 6:f495a77c2c95 311 pc.printf("State is FAILURE\r\n");
s1725696 6:f495a77c2c95 312 StateChanged = false; // state is still FAILURE
s1725696 6:f495a77c2c95 313 }
s1725696 6:f495a77c2c95 314
s1725696 7:ec5add330cb3 315 if(button_wait == true) // condition for FAILURE --> WAIT; button_wait press (IF THAT IS EVEN POSSIBLE IN THIS STATE?)
s1725696 6:f495a77c2c95 316 {
s1725696 6:f495a77c2c95 317 CurrentState = WAIT;
s1725696 9:d7a6a3619576 318 pc.printf("State is WAIT\r\n");
s1725696 6:f495a77c2c95 319 StateChanged = true;
s1725696 6:f495a77c2c95 320 }
s1725696 6:f495a77c2c95 321
s1725696 6:f495a77c2c95 322 break;
s1725696 6:f495a77c2c95 323
s1725696 6:f495a77c2c95 324 case DEMO:
s1725696 6:f495a77c2c95 325
s1725696 6:f495a77c2c95 326 if(StateChanged) // so if StateChanged is true
s1725696 6:f495a77c2c95 327 {
s1725696 6:f495a77c2c95 328 // Execute DEMO mode
s1725696 6:f495a77c2c95 329 pc.printf("State is DEMO\r\n");
s1725696 6:f495a77c2c95 330 StateChanged = false; // state is still DEMO
s1725696 6:f495a77c2c95 331 }
s1725696 6:f495a77c2c95 332
s1725696 7:ec5add330cb3 333 if(button_wait == true) // condition for DEMO --> WAIT; button_wait press
s1725696 6:f495a77c2c95 334 {
s1725696 6:f495a77c2c95 335 CurrentState = WAIT;
s1725696 9:d7a6a3619576 336 pc.printf("State is WAIT\r\n");
s1725696 6:f495a77c2c95 337 StateChanged = true;
s1725696 6:f495a77c2c95 338 }
s1725696 6:f495a77c2c95 339
s1725696 7:ec5add330cb3 340 if (button_emergency == true) // condition for DEMO --> FAILURE; button_emergency press
s1725696 6:f495a77c2c95 341 {
s1725696 6:f495a77c2c95 342 CurrentState = FAILURE;
s1725696 9:d7a6a3619576 343 pc.printf("State is FAILURE\r\n");
s1725696 6:f495a77c2c95 344 StateChanged = true;
s1725696 6:f495a77c2c95 345 }
s1725696 6:f495a77c2c95 346
s1725696 6:f495a77c2c95 347 break;
s1725696 6:f495a77c2c95 348
s1725696 6:f495a77c2c95 349 // no default
s1725696 4:8183e7b228f0 350 }
s1725696 6:f495a77c2c95 351
s1725696 6:f495a77c2c95 352 // while loop does not have to loop every time
s1725696 5:3581013d4505 353 }
s1725696 5:3581013d4505 354
s1725696 0:cb8857cf3ea4 355 }