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: FastPWM mbed QEI biquadFilter HIDScope MODSERIAL
main.cpp@17:0ae9e8c958f8, 2018-10-19 (annotated)
- Committer:
- efvanmarrewijk
- Date:
- Fri Oct 19 12:43:58 2018 +0000
- Revision:
- 17:0ae9e8c958f8
- Parent:
- 16:720365110953
- Child:
- 18:ca084c362855
Only gets counts input from encoder for motor 1 and 2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
efvanmarrewijk | 16:720365110953 | 1 | // Inclusion of libraries |
Ramonwaninge | 0:3ea1bbfbeaae | 2 | #include "mbed.h" |
efvanmarrewijk | 11:3efd6a324f16 | 3 | #include "FastPWM.h" |
efvanmarrewijk | 11:3efd6a324f16 | 4 | #include "QEI.h" // Includes library for encoder |
efvanmarrewijk | 13:6556cd086d07 | 5 | #include "MODSERIAL.h" |
efvanmarrewijk | 13:6556cd086d07 | 6 | #include "HIDScope.h" |
efvanmarrewijk | 13:6556cd086d07 | 7 | #include "BiQuad.h" |
Ramonwaninge | 0:3ea1bbfbeaae | 8 | |
efvanmarrewijk | 14:e21cb701ccb8 | 9 | // Input |
efvanmarrewijk | 9:65c52c1f4a57 | 10 | |
efvanmarrewijk | 14:e21cb701ccb8 | 11 | // Output |
Ramonwaninge | 2:d8a552d1d33a | 12 | |
efvanmarrewijk | 16:720365110953 | 13 | // Utilisation of libraries |
efvanmarrewijk | 16:720365110953 | 14 | MODSERIAL pc(USBTX, USBRX); |
efvanmarrewijk | 17:0ae9e8c958f8 | 15 | QEI Encoder1(D10,D11,NC,4200); // Counterclockwise motor rotation is the positive direction |
efvanmarrewijk | 17:0ae9e8c958f8 | 16 | QEI Encoder2(D8,D9,NC,4200); // Counterclockwise motor rotation is the positive direction |
efvanmarrewijk | 9:65c52c1f4a57 | 17 | |
efvanmarrewijk | 16:720365110953 | 18 | // Global variables |
efvanmarrewijk | 16:720365110953 | 19 | |
efvanmarrewijk | 16:720365110953 | 20 | // Functions |
efvanmarrewijk | 16:720365110953 | 21 | |
efvanmarrewijk | 16:720365110953 | 22 | // Main program |
efvanmarrewijk | 11:3efd6a324f16 | 23 | int main() |
efvanmarrewijk | 11:3efd6a324f16 | 24 | { |
efvanmarrewijk | 14:e21cb701ccb8 | 25 | pc.baud(115200); |
efvanmarrewijk | 17:0ae9e8c958f8 | 26 | |
efvanmarrewijk | 16:720365110953 | 27 | while (true) |
efvanmarrewijk | 17:0ae9e8c958f8 | 28 | { |
efvanmarrewijk | 17:0ae9e8c958f8 | 29 | int counts1 = Encoder1.getPulses(); |
efvanmarrewijk | 17:0ae9e8c958f8 | 30 | int counts2 = Encoder2.getPulses(); |
efvanmarrewijk | 17:0ae9e8c958f8 | 31 | pc.printf("Counts1: %i Counts2: %i\r\n",counts1,counts2); |
Ramonwaninge | 3:d39285fdd103 | 32 | } |
Ramonwaninge | 0:3ea1bbfbeaae | 33 | } |