Task 5.2.1 updates

Fork of Task521 by Nicholas Outram

main.cpp

Committer:
noutram
Date:
2019-10-10
Revision:
3:6080fb2fed90
Parent:
2:2d160e1aa8d8

File content as of revision 3:6080fb2fed90:

#include "mbed.h"

//Time period
#define T 0.01

//Mark-Space Ratio
#define R 0.1

//Mark and Space times
#define Tmark (R*T)
#define Tspace ((1.0-R)*T)

DigitalOut onboardLed(LED1);
DigitalOut redLED(D7);

int main() {
    printf("\nWelcome to ELEC\n");
    
        while (1) {
                redLED = 0; //Space
                onboardLed = 0;
                wait(Tspace);
                redLED = 1; //Mark
                onboardLed = 1;
                wait(Tmark);
        }
}