University of Plymouth - Stages 1, 2 and 3
/
Task521-FZ429ZI
Updated for FZ429ZI
Fork of Task521 by
main.cpp@0:62279e997317, 2015-09-24 (annotated)
- Committer:
- noutram
- Date:
- Thu Sep 24 12:31:22 2015 +0000
- Revision:
- 0:62279e997317
- Child:
- 2:1036de51da45
Initial version 24-09-2015
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 | 0:62279e997317 | 17 | printf("\nWelcome to ELEC143\n"); |
noutram | 0:62279e997317 | 18 | |
noutram | 0:62279e997317 | 19 | while (1) { |
noutram | 0:62279e997317 | 20 | redLED = 0; //Space |
noutram | 0:62279e997317 | 21 | wait(Tspace); |
noutram | 0:62279e997317 | 22 | redLED = 1; //Mark |
noutram | 0:62279e997317 | 23 | wait(Tmark); |
noutram | 0:62279e997317 | 24 | } |
noutram | 0:62279e997317 | 25 | } |