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.
Dependencies: mbed
Revision 2:9e5b526db3aa, committed 2016-03-03
- Comitter:
- winstonkuo
- Date:
- Thu Mar 03 05:09:48 2016 +0000
- Parent:
- 1:d5cf0fdad0f1
- Child:
- 3:b81cc31bfcba
- Commit message:
- 2016/3/3; LED; Winston edited
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Feb 29 16:11:39 2016 +0000
+++ b/main.cpp Thu Mar 03 05:09:48 2016 +0000
@@ -7,6 +7,7 @@
DigitalOut led_1(LED_1);
DigitalOut led_2(LED_2);
Ticker timer_1;
+bool light;
int timer_1_counter;
@@ -16,6 +17,7 @@
led_2 = 0;
timer_1_counter = 0;
+ light = false;
}
void timer_1_interrupt()
@@ -38,9 +40,16 @@
if(timer_1_counter == 1000)
{
// led_1 flashes
- led_1 = 1;
- wait_ms(1);
- led_1 = 0;
+ if(light == false)
+ {
+ led_1 = 1;
+ light = true;
+ }
+ else
+ {
+ led_1 = 0;
+ light = false;
+ }
// reset timer_1_counter to zero
timer_1_counter = 0;