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: DigitDisplay mbed
Revision 0:99516934afee, committed 2014-04-28
- Comitter:
- yihui
- Date:
- Mon Apr 28 03:05:15 2014 +0000
- Commit message:
- initial
Changed in this revision
diff -r 000000000000 -r 99516934afee DigitDisplay.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DigitDisplay.lib Mon Apr 28 03:05:15 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/seeed/code/DigitDisplay/#d3173c8bfd48
diff -r 000000000000 -r 99516934afee main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Apr 28 03:05:15 2014 +0000
@@ -0,0 +1,57 @@
+#include "mbed.h"
+#include "DigitDisplay.h"
+
+DigitDisplay display(P1_14, P1_13); // 4-Digit Display connected to UART Grove connector
+DigitalOut led(LED1);
+DigitalOut led2(LED2);
+Ticker tick;
+uint8_t hour = 0;
+uint8_t minute = 0;
+uint8_t second = 0;
+uint8_t colon = 0;
+
+uint8_t display_buffer[4] = {0, 0, 0, 0};
+
+void handler(void)
+{
+ display.setColon(colon);
+ led2 = !led2;
+ if (colon) {
+ colon = 0;
+
+ second++;
+ if (second >= 60) {
+ second = 0;
+
+ minute++;
+ if (minute >= 60) {
+ minute = 0;
+
+ hour++;
+ if (hour >= 24) {
+ hour = 0;
+ }
+ }
+
+
+ display_buffer[0] = hour / 10;
+ display_buffer[1] = hour % 10;
+
+ display_buffer[2] = minute / 10;
+ display_buffer[3] = minute % 10;
+
+ display.write(display_buffer);
+ }
+ } else {
+ colon = 1;
+ }
+}
+
+int main() {
+ display.write(display_buffer);
+ tick.attach(handler, 0.5);
+ while(1) {
+ led = !led;
+ wait(0.5);
+ }
+}
diff -r 000000000000 -r 99516934afee mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Apr 28 03:05:15 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6473597d706e \ No newline at end of file