This is a simple clock (hh:mm) make with the library Multi7Seg. The library and the demo software is make by 5OFT.

Dependencies:   mbed Led7Seg Multi7Seg

Files at this revision

API Documentation at this revision

Comitter:
trombettamichele
Date:
Sat Apr 23 10:33:59 2011 +0000
Commit message:

Changed in this revision

Led7Seg.lib Show annotated file Show diff for this revision Revisions of this file
Multi7Seg.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 0040aea2c9f6 Led7Seg.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Led7Seg.lib	Sat Apr 23 10:33:59 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/trombettamichele/code/Led7Seg/#78b3b8aefd3c
diff -r 000000000000 -r 0040aea2c9f6 Multi7Seg.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Multi7Seg.lib	Sat Apr 23 10:33:59 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/trombettamichele/code/Multi7Seg/#4ee2f3c3cf46
diff -r 000000000000 -r 0040aea2c9f6 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Apr 23 10:33:59 2011 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+#include "Multi7Seg.h"
+//##### A simple Clock #####
+//  Created by Michele Trombetta
+//  Copyright 2010 5OFT. All rights reserved.
+
+Ticker  ticker_sec;
+Multi7Seg   d_seconds(p21, p22, p23, p24, p25, p26, p27, p20, p19, led_ANODE);
+Multi7Seg   d_minutes(p21, p22, p23, p24, p25, p26, p27, p18, p17, led_ANODE);
+DigitalOut  seconds(p16);
+
+unsigned int cnt_h = 0, cnt_m = 0, cnt_s = 0;
+
+void inc_num() {
+    cnt_s++;
+    seconds = !seconds;
+    if (cnt_s == 60) {
+        cnt_s = 0;
+        cnt_m++;
+    }
+    if (cnt_m == 60) {
+        cnt_m = 0;
+        cnt_h++;
+    }
+    if (cnt_h == 24) cnt_h = 0;
+}
+
+int main() {
+
+    ticker_sec.attach(&inc_num, 1);
+    seconds = 0;
+    d_minutes.setformat(format_DEC);
+    d_seconds.setformat(format_DEC);
+    //d_seconds.setenabled(1); // Simple test to disable a single display
+    while (1) {
+        d_minutes.write(cnt_m);
+        d_seconds.write(cnt_s);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 0040aea2c9f6 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Apr 23 10:33:59 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912