Meghan Haviland / Mbed 2 deprecated A2_2_Single_Timer_Fork

Dependencies:   mbed A3_1_Single_Timer

main.cpp

Committer:
slicht_instructor
Date:
2021-10-07
Revision:
1:3cadb8807520
Parent:
0:5597320f2dba

File content as of revision 1:3cadb8807520:

//Base code for modification for Assignment 2.2
//Blinks LED2 every 200ms using a single Timer object.
//Created: S. Licht, 10/04/2020

#include "mbed.h"

Timer timerLED2;  //creat timer object
DigitalOut LEDOut2(LED2);

int main()
{
    timerLED2.start(); //start timer counting

    while(1) {
        if (timerLED2.read_ms()>=200) { //check to see if time has been exceeded
            LEDOut2 = !LEDOut2;
            timerLED2.reset();  //reset the timer back to zero
        }  //if timer

        //if you had other code that you wanted to execute faster,
        //you could put it here!
        
    } //while
}