Changed some stuff
Fork of EMG by
Diff: emg.cpp
- Revision:
- 31:6845e4099492
- Parent:
- 30:aa0389e04d47
--- a/emg.cpp Thu Oct 29 16:36:36 2015 +0000 +++ b/emg.cpp Thu Oct 29 17:09:45 2015 +0000 @@ -4,6 +4,7 @@ #include "math.h" //Define objects +Serial pc5(USBTX, USBRX); AnalogIn b_emg(A0); //Analog input bicep AnalogIn t_emg(A1); //Analog input tricep AnalogIn p_emg(A2); //Analog input bicep for push @@ -93,7 +94,7 @@ } variance /=300; rust = mean-variance; - printf("Rust %f\r\n",rust); + pc5.printf("Rust %f\r\n",rust); } if(emg == 1) { @@ -115,11 +116,11 @@ } variance /=300; b_min = mean-variance; - printf("b %f\r\n",b_min); - printf("r %f\r\n",rust); + pc5.printf("b %f\r\n",b_min); + pc5.printf("r %f\r\n",rust); b_min += rust; b_min /= 2; - printf("b_min %f\r\n",b_min); + pc5.printf("b_min %f\r\n",b_min); } else if(emg == 2) { for(int i=0; i<900; i++) { @@ -140,11 +141,11 @@ } variance /=300; t_min = mean-variance; - printf("b %f\r\n",t_min); - printf("r %f\r\n",rust); + pc5.printf("b %f\r\n",t_min); + pc5.printf("r %f\r\n",rust); t_min += rust; t_min /= 2; - printf("t_min %f\r\n",t_min); + pc5.printf("t_min %f\r\n",t_min); } else if(emg == 3) { @@ -166,11 +167,11 @@ } variance /=300; p_min = mean-variance; - printf("b %f\r\n",p_min); - printf("r %f\r\n",rust); + pc5.printf("b %f\r\n",p_min); + pc5.printf("r %f\r\n",rust); p_min += rust; p_min /= 2; - printf("p_min %f\r\n",p_min); + pc5.printf("p_min %f\r\n",p_min); } @@ -218,7 +219,7 @@ } else { bicout = last_biceps; } - printf("minbic %f\t",bicout); + pc5.printf("minbic %f\t",bicout); last_biceps = bicout; /*if (output3>0.06) {//This is the output for the right bicep @@ -244,7 +245,7 @@ } else { tricout = last_triceps; } - printf("mintric %f\t",tricout); + pc5.printf("mintric %f\t",tricout); last_triceps = tricout; if (last_push ==0 and output9>p_min+0.1*p_min) {//this is the output for the left bicep (the push motion) @@ -254,7 +255,7 @@ } else { pushout = last_push; } - printf("minpush %f\r\n",pushout); + pc5.printf("minpush %f\r\n",pushout); last_push = pushout;