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.
Fork of Task521 by
main.cpp@3:6080fb2fed90, 2019-10-10 (annotated)
- Committer:
- noutram
- Date:
- Thu Oct 10 15:48:19 2019 +0000
- Revision:
- 3:6080fb2fed90
- Parent:
- 2:2d160e1aa8d8
tweaks
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
noutram | 0:62279e997317 | 1 | #include "mbed.h" |
noutram | 0:62279e997317 | 2 | |
noutram | 0:62279e997317 | 3 | //Time period |
noutram | 0:62279e997317 | 4 | #define T 0.01 |
noutram | 0:62279e997317 | 5 | |
noutram | 0:62279e997317 | 6 | //Mark-Space Ratio |
noutram | 0:62279e997317 | 7 | #define R 0.1 |
noutram | 0:62279e997317 | 8 | |
noutram | 0:62279e997317 | 9 | //Mark and Space times |
noutram | 0:62279e997317 | 10 | #define Tmark (R*T) |
noutram | 0:62279e997317 | 11 | #define Tspace ((1.0-R)*T) |
noutram | 0:62279e997317 | 12 | |
noutram | 0:62279e997317 | 13 | DigitalOut onboardLed(LED1); |
noutram | 0:62279e997317 | 14 | DigitalOut redLED(D7); |
noutram | 0:62279e997317 | 15 | |
noutram | 0:62279e997317 | 16 | int main() { |
noutram | 3:6080fb2fed90 | 17 | printf("\nWelcome to ELEC\n"); |
noutram | 0:62279e997317 | 18 | |
noutram | 0:62279e997317 | 19 | while (1) { |
noutram | 0:62279e997317 | 20 | redLED = 0; //Space |
noutram | 2:2d160e1aa8d8 | 21 | onboardLed = 0; |
noutram | 0:62279e997317 | 22 | wait(Tspace); |
noutram | 0:62279e997317 | 23 | redLED = 1; //Mark |
noutram | 2:2d160e1aa8d8 | 24 | onboardLed = 1; |
noutram | 0:62279e997317 | 25 | wait(Tmark); |
noutram | 0:62279e997317 | 26 | } |
noutram | 0:62279e997317 | 27 | } |