Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 0:5597320f2dba
- Child:
- 1:60db0821e5bc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Oct 04 15:50:17 2020 +0000 @@ -0,0 +1,24 @@ +//Base code for modification for Assignment 2.1 +//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 +}