![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Code for emg filtering and thus controlling the robotic movement.
Dependencies: HIDScope biquadFilter mbed
Fork of EMG by
main.cpp@2:e314bb3b2d99, 2013-05-31 (annotated)
- Committer:
- vsluiter
- Date:
- Fri May 31 08:33:42 2013 +0000
- Revision:
- 2:e314bb3b2d99
- Parent:
- 1:db54d9412d18
- Child:
- 3:1296e996026a
Now really at 1ms
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vsluiter | 0:32bb76391d89 | 1 | #include "mbed.h" |
vsluiter | 0:32bb76391d89 | 2 | |
vsluiter | 2:e314bb3b2d99 | 3 | //Classes |
ArvidKeemink | 1:db54d9412d18 | 4 | AnalogIn emg0(PTB0); //Analog input |
ArvidKeemink | 1:db54d9412d18 | 5 | PwmOut red(LED_RED); //PWM output |
vsluiter | 2:e314bb3b2d99 | 6 | Ticker timer; |
vsluiter | 2:e314bb3b2d99 | 7 | Serial pc(USBTX,USBRX); |
vsluiter | 2:e314bb3b2d99 | 8 | |
vsluiter | 2:e314bb3b2d99 | 9 | //Functions |
vsluiter | 2:e314bb3b2d99 | 10 | void looper() |
vsluiter | 2:e314bb3b2d99 | 11 | { |
vsluiter | 2:e314bb3b2d99 | 12 | float emg_value; |
vsluiter | 2:e314bb3b2d99 | 13 | red = emg_value = emg0; |
vsluiter | 2:e314bb3b2d99 | 14 | pc.printf("%.6f\n",emg_value); |
vsluiter | 2:e314bb3b2d99 | 15 | } |
vsluiter | 0:32bb76391d89 | 16 | |
vsluiter | 0:32bb76391d89 | 17 | int main() |
vsluiter | 0:32bb76391d89 | 18 | { |
vsluiter | 2:e314bb3b2d99 | 19 | pc.baud(115200); |
vsluiter | 2:e314bb3b2d99 | 20 | red.period_ms(2); |
vsluiter | 2:e314bb3b2d99 | 21 | timer.attach(looper, 0.001); |
ArvidKeemink | 1:db54d9412d18 | 22 | while(1) //Loop |
vsluiter | 0:32bb76391d89 | 23 | { |
vsluiter | 2:e314bb3b2d99 | 24 | |
vsluiter | 0:32bb76391d89 | 25 | |
vsluiter | 0:32bb76391d89 | 26 | } |
vsluiter | 0:32bb76391d89 | 27 | } |