Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: HIDScope mbed MODSERIAL QEI
main.cpp@7:c17f5473f4e1, 2017-10-17 (annotated)
- Committer:
- john111222333
- Date:
- Tue Oct 17 06:29:42 2017 +0000
- Revision:
- 7:c17f5473f4e1
- Parent:
- 6:452e301a105a
- Child:
- 8:0b7925095416
unknown changes;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Alex_Kyrl | 6:452e301a105a | 1 | #include "EMG.h" |
Alex_Kyrl | 6:452e301a105a | 2 | #include "Motor.h" |
poephoofd | 0:2d9dae739559 | 3 | #include "HIDScope.h" |
poephoofd | 2:a08bff88216d | 4 | #include "MODSERIAL.h" |
poephoofd | 0:2d9dae739559 | 5 | |
poephoofd | 0:2d9dae739559 | 6 | //Initialize Analog EMG inputs |
Alex_Kyrl | 6:452e301a105a | 7 | EMG EMG_bi_r(A0); |
Alex_Kyrl | 6:452e301a105a | 8 | EMG EMG_bi_l(A1); |
Alex_Kyrl | 6:452e301a105a | 9 | EMG EMG_tri_r(A2); |
Alex_Kyrl | 6:452e301a105a | 10 | EMG EMG_tri_l(A3); |
poephoofd | 0:2d9dae739559 | 11 | |
Alex_Kyrl | 6:452e301a105a | 12 | |
Alex_Kyrl | 6:452e301a105a | 13 | |
Alex_Kyrl | 6:452e301a105a | 14 | HIDScope scope(1); // 4 channels of data |
poephoofd | 0:2d9dae739559 | 15 | Ticker MainTicker; |
poephoofd | 0:2d9dae739559 | 16 | MODSERIAL pc(USBTX, USBRX); |
poephoofd | 0:2d9dae739559 | 17 | |
Alex_Kyrl | 6:452e301a105a | 18 | const double sample_time= 0.002; //fs = 500Hz |
poephoofd | 3:9c5aea210f1d | 19 | |
poephoofd | 0:2d9dae739559 | 20 | |
poephoofd | 0:2d9dae739559 | 21 | |
poephoofd | 0:2d9dae739559 | 22 | void ReadAndFilterEMG() |
poephoofd | 0:2d9dae739559 | 23 | { |
poephoofd | 0:2d9dae739559 | 24 | |
poephoofd | 0:2d9dae739559 | 25 | |
john111222333 | 7:c17f5473f4e1 | 26 | scope.set(0, EMG_bi_r.filter()); |
poephoofd | 0:2d9dae739559 | 27 | scope.send(); |
poephoofd | 2:a08bff88216d | 28 | /*****/ |
poephoofd | 2:a08bff88216d | 29 | } |
poephoofd | 2:a08bff88216d | 30 | |
poephoofd | 2:a08bff88216d | 31 | int main(void) |
poephoofd | 2:a08bff88216d | 32 | { |
poephoofd | 2:a08bff88216d | 33 | pc.baud(115200); //Set Baud rate for Serial communication |
Alex_Kyrl | 6:452e301a105a | 34 | MainTicker.attach(&ReadAndFilterEMG, sample_time); //Attach time based interrupt |
poephoofd | 0:2d9dae739559 | 35 | |
poephoofd | 2:a08bff88216d | 36 | /* |
poephoofd | 2:a08bff88216d | 37 | while(true) |
poephoofd | 2:a08bff88216d | 38 | { |
poephoofd | 2:a08bff88216d | 39 | |
poephoofd | 2:a08bff88216d | 40 | } |
poephoofd | 2:a08bff88216d | 41 | */ |
poephoofd | 2:a08bff88216d | 42 | |
poephoofd | 2:a08bff88216d | 43 | return 0; |
poephoofd | 0:2d9dae739559 | 44 | } |