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: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
main.cpp@8:d1794f225fff, 2019-09-14 (annotated)
- Committer:
- Hendrikvg
- Date:
- Sat Sep 14 11:08:13 2019 +0000
- Revision:
- 8:d1794f225fff
- Parent:
- 7:d307e31f7391
- Child:
- 9:12b9865e7373
Assignment 5: Works, except for notifying the user it only prints the first few characters of the string, then executes the flashes and then prints the remaining characters of the string.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RobertoO | 0:67c50348f842 | 1 | #include "mbed.h" |
RobertoO | 1:b862262a9d14 | 2 | #include "MODSERIAL.h" |
Hendrikvg | 8:d1794f225fff | 3 | #include "Callback.h" |
RobertoO | 0:67c50348f842 | 4 | |
RobertoO | 1:b862262a9d14 | 5 | MODSERIAL pc(USBTX, USBRX); |
Hendrikvg | 3:68d78770639b | 6 | DigitalOut ledr(LED_RED); |
Hendrikvg | 8:d1794f225fff | 7 | InterruptIn sw2(SW2); |
Hendrikvg | 2:d9b0ebf3fcca | 8 | |
Hendrikvg | 8:d1794f225fff | 9 | int n = 0; |
Hendrikvg | 7:d307e31f7391 | 10 | |
Hendrikvg | 8:d1794f225fff | 11 | void flash() |
Hendrikvg | 8:d1794f225fff | 12 | { |
Hendrikvg | 8:d1794f225fff | 13 | n++; |
Hendrikvg | 8:d1794f225fff | 14 | pc.printf("The LED is now going to flash %i times.\n\r",n); |
Hendrikvg | 8:d1794f225fff | 15 | for (int i = 0; i < n; i++) { |
Hendrikvg | 8:d1794f225fff | 16 | ledr = 0; |
Hendrikvg | 8:d1794f225fff | 17 | wait_ms(50); |
Hendrikvg | 8:d1794f225fff | 18 | ledr = 1; |
Hendrikvg | 8:d1794f225fff | 19 | wait_ms(200); |
Hendrikvg | 7:d307e31f7391 | 20 | } |
Hendrikvg | 8:d1794f225fff | 21 | } |
Hendrikvg | 7:d307e31f7391 | 22 | |
RobertoO | 0:67c50348f842 | 23 | int main() |
RobertoO | 0:67c50348f842 | 24 | { |
RobertoO | 0:67c50348f842 | 25 | pc.baud(115200); |
Hendrikvg | 8:d1794f225fff | 26 | ledr = 1; |
Hendrikvg | 8:d1794f225fff | 27 | sw2.fall(flash); |
Hendrikvg | 7:d307e31f7391 | 28 | while(1) { |
RobertoO | 0:67c50348f842 | 29 | } |
Hendrikvg | 2:d9b0ebf3fcca | 30 | } |