EMG filter step by step
Dependencies: HIDScope MODSERIAL mbed-dsp mbed
EMGfilter.cpp@0:e24c2f32e23e, 2014-10-20 (annotated)
- Committer:
- Tanja2211
- Date:
- Mon Oct 20 13:06:38 2014 +0000
- Revision:
- 0:e24c2f32e23e
d
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Tanja2211 | 0:e24c2f32e23e | 1 | #include "mbed.h" |
Tanja2211 | 0:e24c2f32e23e | 2 | #include "HIDScope.h" |
Tanja2211 | 0:e24c2f32e23e | 3 | #include "MODSERIAL.h" |
Tanja2211 | 0:e24c2f32e23e | 4 | #include "arm_math.h" |
Tanja2211 | 0:e24c2f32e23e | 5 | |
Tanja2211 | 0:e24c2f32e23e | 6 | |
Tanja2211 | 0:e24c2f32e23e | 7 | // ****** emg filter shizzle ****** |
Tanja2211 | 0:e24c2f32e23e | 8 | |
Tanja2211 | 0:e24c2f32e23e | 9 | //Define objects |
Tanja2211 | 0:e24c2f32e23e | 10 | AnalogIn emgB(PTB0); //Analog input bicep |
Tanja2211 | 0:e24c2f32e23e | 11 | AnalogIn emgT(PTB1); //Analog input tricep |
Tanja2211 | 0:e24c2f32e23e | 12 | |
Tanja2211 | 0:e24c2f32e23e | 13 | float filtered_emgB; |
Tanja2211 | 0:e24c2f32e23e | 14 | float filtered_emgT; |
Tanja2211 | 0:e24c2f32e23e | 15 | float MeanT2, MeanB1, MeanB2, MeanB3; |
Tanja2211 | 0:e24c2f32e23e | 16 | float filtered_emgT10_C, filtered_emgT11_C, filtered_emgT12_C, filtered_emgT13_C, filtered_emgT14_C, filtered_emgT15_C, filtered_emgT16_C, filtered_emgT17_C, filtered_emgT18_C, filtered_emgT19_C, filtered_emgT110_C, filtered_emgT111_C, filtered_emgT112_C, filtered_emgT113_C, filtered_emgT114_C, filtered_emgT115_C, filtered_emgT116_C, filtered_emgT117_C, filtered_emgT118_C, filtered_emgT119_C; |
Tanja2211 | 0:e24c2f32e23e | 17 | float B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, MOVAVG_B; |
Tanja2211 | 0:e24c2f32e23e | 18 | float T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, MOVAVG_T; |
Tanja2211 | 0:e24c2f32e23e | 19 | float drempelwaardeB1, drempelwaardeB2, drempelwaardeB3, drempelwaardeT1, drempelwaardeT2; |
Tanja2211 | 0:e24c2f32e23e | 20 | |
Tanja2211 | 0:e24c2f32e23e | 21 | MODSERIAL pc(USBTX,USBRX); |
Tanja2211 | 0:e24c2f32e23e | 22 | |
Tanja2211 | 0:e24c2f32e23e | 23 | HIDScope scope(4);//uitgang scherm |
Tanja2211 | 0:e24c2f32e23e | 24 | |
Tanja2211 | 0:e24c2f32e23e | 25 | arm_biquad_casd_df1_inst_f32 lowpass; |
Tanja2211 | 0:e24c2f32e23e | 26 | //constants for 50Hz lowpass |
Tanja2211 | 0:e24c2f32e23e | 27 | float lowpass_const[] = {0.2928920553, 0.5857841107, 0.2928920554, -0, -0.17156822136};//{a0 a1 a2 -b1 -b2} van online calculator |
Tanja2211 | 0:e24c2f32e23e | 28 | //state values |
Tanja2211 | 0:e24c2f32e23e | 29 | float lowpass_states[4]; |
Tanja2211 | 0:e24c2f32e23e | 30 | |
Tanja2211 | 0:e24c2f32e23e | 31 | arm_biquad_casd_df1_inst_f32 highpass; |
Tanja2211 | 0:e24c2f32e23e | 32 | //constants for 10Hz highpass |
Tanja2211 | 0:e24c2f32e23e | 33 | float highpass_const[] = {0.8005910267, -1.6011820533, 0.8005910267, 1.5610153913, -0.6413487154};//{a0 a1 a2 -b1 -b2} |
Tanja2211 | 0:e24c2f32e23e | 34 | //state values |
Tanja2211 | 0:e24c2f32e23e | 35 | float highpass_states[4]; |
Tanja2211 | 0:e24c2f32e23e | 36 | |
Tanja2211 | 0:e24c2f32e23e | 37 | |
Tanja2211 | 0:e24c2f32e23e | 38 | /** Looper function |
Tanja2211 | 0:e24c2f32e23e | 39 | * functions used for Ticker and Timeout should be of type void <name>(void) |
Tanja2211 | 0:e24c2f32e23e | 40 | * i.e. no input arguments, no output arguments. |
Tanja2211 | 0:e24c2f32e23e | 41 | * if you want to change a variable that you use in other places (for example in main) |
Tanja2211 | 0:e24c2f32e23e | 42 | * you will have to make that variable global in order to be able to reach it both from |
Tanja2211 | 0:e24c2f32e23e | 43 | * the function called at interrupt time, and in the main function. |
Tanja2211 | 0:e24c2f32e23e | 44 | * To make a variable global, define it under the includes. |
Tanja2211 | 0:e24c2f32e23e | 45 | * variables that are changed in the interrupt routine (written to) should be made |
Tanja2211 | 0:e24c2f32e23e | 46 | * 'volatile' to let the compiler know that those values may change outside the current context. |
Tanja2211 | 0:e24c2f32e23e | 47 | * i.e.: "volatile uint16_t emg_value;" instead of "uint16_t emg_value" |
Tanja2211 | 0:e24c2f32e23e | 48 | * in the example below, the variable is not re-used in the main function, and is thus declared |
Tanja2211 | 0:e24c2f32e23e | 49 | * local in the looper function only. |
Tanja2211 | 0:e24c2f32e23e | 50 | **/ |
Tanja2211 | 0:e24c2f32e23e | 51 | |
Tanja2211 | 0:e24c2f32e23e | 52 | // Calibratie |
Tanja2211 | 0:e24c2f32e23e | 53 | |
Tanja2211 | 0:e24c2f32e23e | 54 | pc.printf("Calibratie drempelwaarde Triceps stand 1\n"); |
Tanja2211 | 0:e24c2f32e23e | 55 | wait(0.5); |
Tanja2211 | 0:e24c2f32e23e | 56 | { |
Tanja2211 | 0:e24c2f32e23e | 57 | int i; |
Tanja2211 | 0:e24c2f32e23e | 58 | int j=19; |
Tanja2211 | 0:e24c2f32e23e | 59 | |
Tanja2211 | 0:e24c2f32e23e | 60 | for (i = 0, i<=j; i ++) { |
Tanja2211 | 0:e24c2f32e23e | 61 | /*variable to store value in*/ |
Tanja2211 | 0:e24c2f32e23e | 62 | uint16_t emg_valueT1i_C; |
Tanja2211 | 0:e24c2f32e23e | 63 | |
Tanja2211 | 0:e24c2f32e23e | 64 | float emg_value_f32T1i_C; |
Tanja2211 | 0:e24c2f32e23e | 65 | /*put raw emg value both in red and in emg_value*/ |
Tanja2211 | 0:e24c2f32e23e | 66 | emg_valueT1i_C = emgT1i_C.read_u16(); // read direct ADC result, converted to 16 bit integer (0..2^16 = 0..65536 = 0..3.3V) |
Tanja2211 | 0:e24c2f32e23e | 67 | emg_value_f32T1i_C = emgT1i_C.read(); |
Tanja2211 | 0:e24c2f32e23e | 68 | |
Tanja2211 | 0:e24c2f32e23e | 69 | //process emg |
Tanja2211 | 0:e24c2f32e23e | 70 | arm_biquad_cascade_df1_f32(&highpass, &emg_value_f32T1i_C, &filtered_emgT1i_C, 1 ); |
Tanja2211 | 0:e24c2f32e23e | 71 | filtered_emgT1i_C = fabs(filtered_emgT1i_C); |
Tanja2211 | 0:e24c2f32e23e | 72 | arm_biquad_cascade_df1_f32(&lowpass, &filtered_emgT1i_C, &filtered_emgT1i_C, 1 ); |
Tanja2211 | 0:e24c2f32e23e | 73 | } |
Tanja2211 | 0:e24c2f32e23e | 74 | } |
Tanja2211 | 0:e24c2f32e23e | 75 | // Mean Triceps stand 1 |
Tanja2211 | 0:e24c2f32e23e | 76 | |
Tanja2211 | 0:e24c2f32e23e | 77 | |
Tanja2211 | 0:e24c2f32e23e | 78 | float MeanT1=filtered_emgT10_C*0.05+filtered_emgT11_C*0.05+filtered_emgT12_C*0.05+filtered_emgT13_C*0.05+filtered_emgT14_C*0.05+filtered_emgT15_C*0.05+filtered_emgT16_C*0.05+filtered_emgT17_C*0.05+filtered_emgT18_C*0.05+filtered_emgT19_C*0.05+filtered_emgT110_C*0.05+filtered_emgT111_C*0.05+filtered_emgT112_C*0.05+filtered_emgT113_C*0.05+filtered_emgT114_C*0.05+filtered_emgT115_C*0.05+filtered_emgT116_C*0.05+filtered_emgT117_C*0.05+filtered_emgT118_C*0.05+filtered_emgT119_C*0.05; |
Tanja2211 | 0:e24c2f32e23e | 79 | |
Tanja2211 | 0:e24c2f32e23e | 80 | |
Tanja2211 | 0:e24c2f32e23e | 81 | |
Tanja2211 | 0:e24c2f32e23e | 82 | |
Tanja2211 | 0:e24c2f32e23e | 83 | |
Tanja2211 | 0:e24c2f32e23e | 84 | //BICEP EMG LEZEN |
Tanja2211 | 0:e24c2f32e23e | 85 | void looperB() |
Tanja2211 | 0:e24c2f32e23e | 86 | { |
Tanja2211 | 0:e24c2f32e23e | 87 | /*variable to store value in*/ |
Tanja2211 | 0:e24c2f32e23e | 88 | uint16_t emg_valueB; |
Tanja2211 | 0:e24c2f32e23e | 89 | |
Tanja2211 | 0:e24c2f32e23e | 90 | float emg_value_f32B; |
Tanja2211 | 0:e24c2f32e23e | 91 | /*put raw emg value both in red and in emg_value*/ |
Tanja2211 | 0:e24c2f32e23e | 92 | emg_valueB = emgB.read_u16(); // read direct ADC result, converted to 16 bit integer (0..2^16 = 0..65536 = 0..3.3V) |
Tanja2211 | 0:e24c2f32e23e | 93 | emg_value_f32B = emgB.read(); |
Tanja2211 | 0:e24c2f32e23e | 94 | |
Tanja2211 | 0:e24c2f32e23e | 95 | //process emg |
Tanja2211 | 0:e24c2f32e23e | 96 | arm_biquad_cascade_df1_f32(&highpass, &emg_value_f32B, &filtered_emgB, 1 ); |
Tanja2211 | 0:e24c2f32e23e | 97 | filtered_emgB = fabs(filtered_emgB); |
Tanja2211 | 0:e24c2f32e23e | 98 | arm_biquad_cascade_df1_f32(&lowpass, &filtered_emgB, &filtered_emgB, 1 ); |
Tanja2211 | 0:e24c2f32e23e | 99 | |
Tanja2211 | 0:e24c2f32e23e | 100 | /*send value to PC. */ |
Tanja2211 | 0:e24c2f32e23e | 101 | scope.set(0,emg_valueB); //uint value |
Tanja2211 | 0:e24c2f32e23e | 102 | scope.set(1,filtered_emgB); //processed float |
Tanja2211 | 0:e24c2f32e23e | 103 | scope.send(); |
Tanja2211 | 0:e24c2f32e23e | 104 | |
Tanja2211 | 0:e24c2f32e23e | 105 | // Moving Average Filter Biceps |
Tanja2211 | 0:e24c2f32e23e | 106 | |
Tanja2211 | 0:e24c2f32e23e | 107 | { |
Tanja2211 | 0:e24c2f32e23e | 108 | B0=filtered_emgB; |
Tanja2211 | 0:e24c2f32e23e | 109 | MOVAVG_B=B0*0.1+B1*0.1+B2*0.1+B3*0.1+B4*0.1+B5*0.1+B6*0.1+B7*0.1+B8*0.1+B9*0.1; |
Tanja2211 | 0:e24c2f32e23e | 110 | B9=B8; |
Tanja2211 | 0:e24c2f32e23e | 111 | B8=B7; |
Tanja2211 | 0:e24c2f32e23e | 112 | B7=B6; |
Tanja2211 | 0:e24c2f32e23e | 113 | B6=B5; |
Tanja2211 | 0:e24c2f32e23e | 114 | B5=B4; |
Tanja2211 | 0:e24c2f32e23e | 115 | B4=B3; |
Tanja2211 | 0:e24c2f32e23e | 116 | B3=B2; |
Tanja2211 | 0:e24c2f32e23e | 117 | B2=B1; |
Tanja2211 | 0:e24c2f32e23e | 118 | B1=B0; |
Tanja2211 | 0:e24c2f32e23e | 119 | } |
Tanja2211 | 0:e24c2f32e23e | 120 | } |
Tanja2211 | 0:e24c2f32e23e | 121 | // Triceps EMG lezen |
Tanja2211 | 0:e24c2f32e23e | 122 | void looperT() |
Tanja2211 | 0:e24c2f32e23e | 123 | { |
Tanja2211 | 0:e24c2f32e23e | 124 | /*variable to store value in*/ |
Tanja2211 | 0:e24c2f32e23e | 125 | uint16_t emg_valueT; |
Tanja2211 | 0:e24c2f32e23e | 126 | |
Tanja2211 | 0:e24c2f32e23e | 127 | float emg_value_f32T; |
Tanja2211 | 0:e24c2f32e23e | 128 | /*put raw emg value both in red and in emg_value*/ |
Tanja2211 | 0:e24c2f32e23e | 129 | emg_valueT = emgT.read_u16(); // read direct ADC result, converted to 16 bit integer (0..2^16 = 0..65536 = 0..3.3V) |
Tanja2211 | 0:e24c2f32e23e | 130 | emg_value_f32T = emgT.read(); |
Tanja2211 | 0:e24c2f32e23e | 131 | |
Tanja2211 | 0:e24c2f32e23e | 132 | //process emg |
Tanja2211 | 0:e24c2f32e23e | 133 | arm_biquad_cascade_df1_f32(&highpass, &emg_value_f32T, &filtered_emgT, 1 ); |
Tanja2211 | 0:e24c2f32e23e | 134 | filtered_emgT = fabs(filtered_emgT); |
Tanja2211 | 0:e24c2f32e23e | 135 | arm_biquad_cascade_df1_f32(&lowpass, &filtered_emgT, &filtered_emgT, 1 ); |
Tanja2211 | 0:e24c2f32e23e | 136 | |
Tanja2211 | 0:e24c2f32e23e | 137 | /*send value to PC. */ |
Tanja2211 | 0:e24c2f32e23e | 138 | scope.set(2,emg_valueT); //uint value |
Tanja2211 | 0:e24c2f32e23e | 139 | scope.set(3,filtered_emgT); //processed float |
Tanja2211 | 0:e24c2f32e23e | 140 | scope.send(); |
Tanja2211 | 0:e24c2f32e23e | 141 | |
Tanja2211 | 0:e24c2f32e23e | 142 | // Moving Average Filter Triceps |
Tanja2211 | 0:e24c2f32e23e | 143 | { |
Tanja2211 | 0:e24c2f32e23e | 144 | T0=filtered_emgT; |
Tanja2211 | 0:e24c2f32e23e | 145 | MOVAVG_T=T0*0.1+T1*0.1+T2*0.1+T3*0.1+T4*0.1+T5*0.1+T6*0.1+T7*0.1+T8*0.1+T9*0.1; |
Tanja2211 | 0:e24c2f32e23e | 146 | |
Tanja2211 | 0:e24c2f32e23e | 147 | T9=T8; |
Tanja2211 | 0:e24c2f32e23e | 148 | T8=T7; |
Tanja2211 | 0:e24c2f32e23e | 149 | T7=T6; |
Tanja2211 | 0:e24c2f32e23e | 150 | T6=T5; |
Tanja2211 | 0:e24c2f32e23e | 151 | T5=T4; |
Tanja2211 | 0:e24c2f32e23e | 152 | T4=T3; |
Tanja2211 | 0:e24c2f32e23e | 153 | T3=T2; |
Tanja2211 | 0:e24c2f32e23e | 154 | T2=T1; |
Tanja2211 | 0:e24c2f32e23e | 155 | T1=T0; |
Tanja2211 | 0:e24c2f32e23e | 156 | } |
Tanja2211 | 0:e24c2f32e23e | 157 | } |
Tanja2211 | 0:e24c2f32e23e | 158 | |
Tanja2211 | 0:e24c2f32e23e | 159 | int main() |
Tanja2211 | 0:e24c2f32e23e | 160 | { |
Tanja2211 | 0:e24c2f32e23e | 161 | Ticker log_timer; |
Tanja2211 | 0:e24c2f32e23e | 162 | //set up filters. Use external array for constants |
Tanja2211 | 0:e24c2f32e23e | 163 | arm_biquad_cascade_df1_init_f32(&lowpass,1 , lowpass_const, lowpass_states); |
Tanja2211 | 0:e24c2f32e23e | 164 | arm_biquad_cascade_df1_init_f32(&highpass,1 ,highpass_const, highpass_states); |
Tanja2211 | 0:e24c2f32e23e | 165 | |
Tanja2211 | 0:e24c2f32e23e | 166 | /**Here you attach the 'void looper(void)' function to the Ticker object |
Tanja2211 | 0:e24c2f32e23e | 167 | * The looper() function will be called every 0.01 seconds. |
Tanja2211 | 0:e24c2f32e23e | 168 | * Please mind that the parentheses after looper are omitted when using attach. |
Tanja2211 | 0:e24c2f32e23e | 169 | */ |
Tanja2211 | 0:e24c2f32e23e | 170 | log_timer.attach(looperB, 0.005);//?? |
Tanja2211 | 0:e24c2f32e23e | 171 | log_timer.attach(looperT, 0.005);//?? |
Tanja2211 | 0:e24c2f32e23e | 172 | while(1) { //Loop |
Tanja2211 | 0:e24c2f32e23e | 173 | /*Empty!*/ |
Tanja2211 | 0:e24c2f32e23e | 174 | /*Everything is handled by the interrupt routine now!*/ |
Tanja2211 | 0:e24c2f32e23e | 175 | } |
Tanja2211 | 0:e24c2f32e23e | 176 | } |
Tanja2211 | 0:e24c2f32e23e | 177 | |
Tanja2211 | 0:e24c2f32e23e | 178 | //filtered_emgB |
Tanja2211 | 0:e24c2f32e23e | 179 | //filtered_emgT |
Tanja2211 | 0:e24c2f32e23e | 180 | |
Tanja2211 | 0:e24c2f32e23e | 181 | void AntwoordT() |
Tanja2211 | 0:e24c2f32e23e | 182 | { |
Tanja2211 | 0:e24c2f32e23e | 183 | drempelwaardeT1=4.99; |
Tanja2211 | 0:e24c2f32e23e | 184 | drempelwaardeT2=7; |
Tanja2211 | 0:e24c2f32e23e | 185 | int yT1, yT2; |
Tanja2211 | 0:e24c2f32e23e | 186 | |
Tanja2211 | 0:e24c2f32e23e | 187 | if (MOVAVG_T > drempelwaardeT1) { |
Tanja2211 | 0:e24c2f32e23e | 188 | yT1=1; |
Tanja2211 | 0:e24c2f32e23e | 189 | if (MOVAVG_T > drempelwaardeT2) { |
Tanja2211 | 0:e24c2f32e23e | 190 | yT2=1; |
Tanja2211 | 0:e24c2f32e23e | 191 | } else { |
Tanja2211 | 0:e24c2f32e23e | 192 | yT2=0; |
Tanja2211 | 0:e24c2f32e23e | 193 | } |
Tanja2211 | 0:e24c2f32e23e | 194 | } else { |
Tanja2211 | 0:e24c2f32e23e | 195 | yT1=0; |
Tanja2211 | 0:e24c2f32e23e | 196 | } |
Tanja2211 | 0:e24c2f32e23e | 197 | |
Tanja2211 | 0:e24c2f32e23e | 198 | int positie; |
Tanja2211 | 0:e24c2f32e23e | 199 | |
Tanja2211 | 0:e24c2f32e23e | 200 | positie=yT1+yT2; |
Tanja2211 | 0:e24c2f32e23e | 201 | if (positie==0) { |
Tanja2211 | 0:e24c2f32e23e | 202 | pc.printf("Motor 2 beweegt niet\n"); |
Tanja2211 | 0:e24c2f32e23e | 203 | } else { |
Tanja2211 | 0:e24c2f32e23e | 204 | pc.printf("Motor 2 gaat beweegen\n"); |
Tanja2211 | 0:e24c2f32e23e | 205 | } |
Tanja2211 | 0:e24c2f32e23e | 206 | if (positie==1) { |
Tanja2211 | 0:e24c2f32e23e | 207 | pc.printf("Motor 2 beweegt naar positie 1\n"); |
Tanja2211 | 0:e24c2f32e23e | 208 | } else { |
Tanja2211 | 0:e24c2f32e23e | 209 | pc.printf("Motor 1 beweegt niet naar positie 1\n"); |
Tanja2211 | 0:e24c2f32e23e | 210 | } |
Tanja2211 | 0:e24c2f32e23e | 211 | if (positie==2) { |
Tanja2211 | 0:e24c2f32e23e | 212 | pc.printf("Motor 1 beweegt naar positie 2\n"); |
Tanja2211 | 0:e24c2f32e23e | 213 | } else { |
Tanja2211 | 0:e24c2f32e23e | 214 | pc.printf("Motor 1 beweegt niet naar positie 2\n"); |
Tanja2211 | 0:e24c2f32e23e | 215 | } |
Tanja2211 | 0:e24c2f32e23e | 216 | } |
Tanja2211 | 0:e24c2f32e23e | 217 | |
Tanja2211 | 0:e24c2f32e23e | 218 | void AntwoordB() { |
Tanja2211 | 0:e24c2f32e23e | 219 | drempelwaardeB1=4.99; |
Tanja2211 | 0:e24c2f32e23e | 220 | drempelwaardeB2=6; |
Tanja2211 | 0:e24c2f32e23e | 221 | drempelwaardeB3=10; |
Tanja2211 | 0:e24c2f32e23e | 222 | int yB1; |
Tanja2211 | 0:e24c2f32e23e | 223 | int yB2; |
Tanja2211 | 0:e24c2f32e23e | 224 | int yB3; |
Tanja2211 | 0:e24c2f32e23e | 225 | |
Tanja2211 | 0:e24c2f32e23e | 226 | if (MOVAVG_B > drempelwaardeB1) { |
Tanja2211 | 0:e24c2f32e23e | 227 | yB1=1; |
Tanja2211 | 0:e24c2f32e23e | 228 | if (MOVAVG_B > drempelwaardeB2) { |
Tanja2211 | 0:e24c2f32e23e | 229 | yB2=1; |
Tanja2211 | 0:e24c2f32e23e | 230 | if (MOVAVG_B > drempelwaardeB3) { |
Tanja2211 | 0:e24c2f32e23e | 231 | yB3=1; |
Tanja2211 | 0:e24c2f32e23e | 232 | } else { |
Tanja2211 | 0:e24c2f32e23e | 233 | yB3=0; |
Tanja2211 | 0:e24c2f32e23e | 234 | } |
Tanja2211 | 0:e24c2f32e23e | 235 | } else { |
Tanja2211 | 0:e24c2f32e23e | 236 | yB2=0; |
Tanja2211 | 0:e24c2f32e23e | 237 | } |
Tanja2211 | 0:e24c2f32e23e | 238 | } else { |
Tanja2211 | 0:e24c2f32e23e | 239 | yB1=0; |
Tanja2211 | 0:e24c2f32e23e | 240 | } |
Tanja2211 | 0:e24c2f32e23e | 241 | |
Tanja2211 | 0:e24c2f32e23e | 242 | int snelheidsstand; |
Tanja2211 | 0:e24c2f32e23e | 243 | |
Tanja2211 | 0:e24c2f32e23e | 244 | snelheidsstand=yB1+yB2+yB3; |
Tanja2211 | 0:e24c2f32e23e | 245 | if (snelheidsstand==1) { |
Tanja2211 | 0:e24c2f32e23e | 246 | pc.printf("Motor 1 beweegt met snelheid 1\n"); |
Tanja2211 | 0:e24c2f32e23e | 247 | } else { |
Tanja2211 | 0:e24c2f32e23e | 248 | pc.printf("Motor 1 beweegt niet met snelheid 1\n"); |
Tanja2211 | 0:e24c2f32e23e | 249 | } |
Tanja2211 | 0:e24c2f32e23e | 250 | if (snelheidsstand==2) { |
Tanja2211 | 0:e24c2f32e23e | 251 | pc.printf("Motor 1 beweegt met snelheid 2\n"); |
Tanja2211 | 0:e24c2f32e23e | 252 | } else { |
Tanja2211 | 0:e24c2f32e23e | 253 | pc.printf("Motor 1 beweegt niet met snelheid 2\n"); |
Tanja2211 | 0:e24c2f32e23e | 254 | } |
Tanja2211 | 0:e24c2f32e23e | 255 | if (snelheidsstand==3) { |
Tanja2211 | 0:e24c2f32e23e | 256 | pc.printf("Motor 1 beweegt met snelheid 3\n"); |
Tanja2211 | 0:e24c2f32e23e | 257 | } else { |
Tanja2211 | 0:e24c2f32e23e | 258 | pc.printf("Motor 1 beweegt niet met snelheid 3\n"); |
Tanja2211 | 0:e24c2f32e23e | 259 | } |
Tanja2211 | 0:e24c2f32e23e | 260 | } |