Task 5.2.1 updates

Fork of Task521 by Nicholas Outram

Committer:
noutram
Date:
Thu Oct 10 15:48:19 2019 +0000
Revision:
3:6080fb2fed90
Parent:
2:2d160e1aa8d8
tweaks

Who changed what in which revision?

UserRevisionLine numberNew 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 }