Changed some stuff
Fork of EMG by
main.cpp@3:1296e996026a, 2013-05-31 (annotated)
- Committer:
- vsluiter
- Date:
- Fri May 31 11:25:09 2013 +0000
- Revision:
- 3:1296e996026a
- Parent:
- 2:e314bb3b2d99
- Child:
- 4:8b298dfada81
Now really at 1kHz
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 | 3:1296e996026a | 24 | |
vsluiter | 0:32bb76391d89 | 25 | } |
vsluiter | 0:32bb76391d89 | 26 | } |