Task 5.2.1 updates

Fork of Task521 by Nicholas Outram

Committer:
noutram
Date:
Thu Jul 13 14:55:37 2017 +0000
Revision:
1:0cbe46a87778
Parent:
0:62279e997317
Child:
2:2d160e1aa8d8
updated for mbed-os 5.5

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