Galileo Hand Basic Example implemented on FRDM K64F
Dependencies: NOKIA_5110 mbed-dsp mbed
Fork of Nucleo_EMG_Galileo_Hand by
Diff: main.cpp
- Revision:
- 3:f784301a5166
- Parent:
- 2:12f979d695db
- Child:
- 4:d8fd3c4484cc
--- a/main.cpp Wed Aug 12 18:05:29 2015 +0000 +++ b/main.cpp Wed Sep 02 01:29:02 2015 +0000 @@ -8,6 +8,11 @@ AnalogIn E1(A1); AnalogIn E2(A2); AnalogIn E3(A3); +PwmOut Thumb(D11); +PwmOut Index(D10); +PwmOut Middle(D9); +PwmOut Pinky(D6); +PwmOut ThumbRot(D5); float32_t EMG1, EMG2, EMG3; float32_t samples[25]; @@ -47,8 +52,23 @@ int main() { pc.baud(115200); //Serial com at 115200 bauds EMG_Sampler.attach(&ADC_Sampler, 0.001); //1ms ticker for ADC Sampler + //Open -> 0.6ms - Close 2.4ms + Thumb.period(0.02f/2.0f); + Thumb.pulsewidth(0.0010f/2.0f); + //Open -> 2.4ms - Close 0.6ms + Index.period(0.02f*2.0f); + Index.pulsewidth(0.0024f*2.0f); + //Open -> 2.4ms - Close 0.6ms + Middle.period(0.02f*2.0f); + Middle.pulsewidth(0.0024f*2.0f); + //Open -> 0.6ms - Close 2.4ms + Pinky.period(0.02f*2.0f); + Pinky.pulsewidth(0.0006f*2.0f); + //Open -> 0.6ms - Close 2.4ms + //ThumbRot.period(0.02f/2.0f); + ThumbRot.pulsewidth(0.0006f*2.0f); + myled = 1; - //Thumb = 0; while(1) { if(COCO){ //mean for threshold @@ -60,9 +80,19 @@ arm_mean_f32(abs_output, 25, &mean3); if ((mean>0.009f)&&(mean2>0.007f)&&(mean3>0.007f)) { myled = 0; + Thumb.pulsewidth(0.0024f/2.0f); + Index.pulsewidth(0.0006f*2.0f); + Middle.pulsewidth(0.0006f*2.0f); + Pinky.pulsewidth(0.0024f*2.0f); + ThumbRot.pulsewidth(0.0024f*2.0f); } else { myled = 1; + Thumb.pulsewidth(0.0010f/2.0f); + Index.pulsewidth(0.0024f*2.0f); + Middle.pulsewidth(0.0024f*2.0f); + Pinky.pulsewidth(0.0006f*2.0f); + ThumbRot.pulsewidth(0.0006f*2.0f); } COCO = 0; }