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.
main.cpp@2:61ec418c186c, 2017-03-08 (annotated)
- Committer:
- cturner48
- Date:
- Wed Mar 08 20:42:25 2017 +0000
- Revision:
- 2:61ec418c186c
- Parent:
- 0:7bb1367b48b8
Updated documentation.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| cturner48 | 0:7bb1367b48b8 | 1 | #include "mbed.h" |
| cturner48 | 0:7bb1367b48b8 | 2 | #include "MyoWare.h" |
| cturner48 | 0:7bb1367b48b8 | 3 | |
| cturner48 | 0:7bb1367b48b8 | 4 | Serial pc(USBTX, USBRX); // tx, rx |
| cturner48 | 0:7bb1367b48b8 | 5 | //AnalogIn sig(p15); // Gives the rectified and integrated EMG signal |
| cturner48 | 0:7bb1367b48b8 | 6 | |
| cturner48 | 0:7bb1367b48b8 | 7 | float logic = 0.7f; |
| cturner48 | 0:7bb1367b48b8 | 8 | int steps = 20; |
| cturner48 | 0:7bb1367b48b8 | 9 | MyoWare ms(p15, logic, steps); |
| cturner48 | 0:7bb1367b48b8 | 10 | |
| cturner48 | 0:7bb1367b48b8 | 11 | //This is a simple test of the myoware muscle sensor |
| cturner48 | 0:7bb1367b48b8 | 12 | int main() { |
| cturner48 | 0:7bb1367b48b8 | 13 | |
| cturner48 | 0:7bb1367b48b8 | 14 | while(1) { |
| cturner48 | 0:7bb1367b48b8 | 15 | float sig_val = ms.read(); |
| cturner48 | 0:7bb1367b48b8 | 16 | bool onOff = ms.control(); |
| cturner48 | 0:7bb1367b48b8 | 17 | int stepNum = ms.magnitude(); |
| cturner48 | 0:7bb1367b48b8 | 18 | //float sect = float(steps/100.0f); |
| cturner48 | 0:7bb1367b48b8 | 19 | |
| cturner48 | 0:7bb1367b48b8 | 20 | |
| cturner48 | 0:7bb1367b48b8 | 21 | |
| cturner48 | 0:7bb1367b48b8 | 22 | pc.printf("Sig Value: %f\n\r", sig_val); |
| cturner48 | 0:7bb1367b48b8 | 23 | pc.printf("Logic Value: %f\n\r", logic); |
| cturner48 | 0:7bb1367b48b8 | 24 | pc.printf("Digital Value: %d\n\r", onOff); |
| cturner48 | 0:7bb1367b48b8 | 25 | pc.printf("Total Steps: %d\n\r", steps); |
| cturner48 | 0:7bb1367b48b8 | 26 | pc.printf("Step Value Value: %d\n\r", stepNum); |
| cturner48 | 0:7bb1367b48b8 | 27 | //pc.printf("temp Value Value: %d\n\r", temp); |
| cturner48 | 0:7bb1367b48b8 | 28 | //pc.printf("sect Value Value: %f\n\r", sect); |
| cturner48 | 0:7bb1367b48b8 | 29 | pc.printf("\n\r"); |
| cturner48 | 0:7bb1367b48b8 | 30 | wait(2); |
| cturner48 | 0:7bb1367b48b8 | 31 | } |
| cturner48 | 0:7bb1367b48b8 | 32 | |
| cturner48 | 0:7bb1367b48b8 | 33 | } |