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 Blinker TextLCD
Revision 4:62ae68bcaee8, committed 2017-01-07
- Comitter:
- jurgis
- Date:
- Sat Jan 07 16:00:42 2017 +0000
- Parent:
- 3:0432064270e1
- Child:
- 5:7f4d61016e8c
- Commit message:
- Using blinker library
Changed in this revision
| Blinker.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Blinker.lib Sat Jan 07 16:00:42 2017 +0000 @@ -0,0 +1,1 @@ +Blinker#ed332628f798
--- a/main.cpp Sat Jan 07 15:04:42 2017 +0000
+++ b/main.cpp Sat Jan 07 16:00:42 2017 +0000
@@ -1,43 +1,27 @@
// Testing MBED with Daniel
#include "mbed.h"
+#include "Blinker.h"
-double getWaitTime();
-
+Timer timer;
DigitalOut led1(LED1);
//DigitalOut greenLed(D8);
//DigitalOut redLed(D10);
//DigitalIn button(D9);
Serial pc(USBTX, USBRX);
+jj::Blinker blinker1(led1, timer);
-Timer timer;
-uint32_t prevMs;
-uint32_t currentMs;
-uint32_t lastToggleMs = 0;
-uint32_t toggleTimeMs = 500;
int main()
{
-// button.mode(PullUp);
-
timer.start();
- currentMs = prevMs = timer.read_ms();
-
pc.baud(115200);
pc.printf("Hello world\r\n");
- led1 = 0;
+ blinker1.blink(200, 1000);
for(;;)
{
- currentMs = timer.read_ms();
-// pc.printf("%ld ms\r\n", currentMs - prevMs);
- prevMs = currentMs;
-
- if (currentMs - lastToggleMs >= toggleTimeMs)
- {
- led1 = !led1;
- lastToggleMs = currentMs;
- }
+ blinker1.update();
}
}