Just sending seconds counter to the serial port
Проект для статьи "Как перестать бояться и полюбить mbed. [Часть 1]" См. https://habrahabr.ru/company/efo/blog/308440/
Diff: main.cpp
- Revision:
- 0:d61b39a672e1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Sep 12 12:12:15 2016 +0000
@@ -0,0 +1,16 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX);
+Ticker timeKeeping;
+
+volatile uint64_t seconds = 0;
+
+void secondsCallback(void) {
+ pc.printf("Number of seconds: %x\r\n", seconds);
+ seconds ++;
+}
+
+int main() {
+ timeKeeping.attach(&secondsCallback, 1.0f);
+ while(1) {}
+}
\ No newline at end of file