stoppuhr

Dependencies:   C12832 mbed

Files at this revision

API Documentation at this revision

Comitter:
TFuchsbichler
Date:
Fri Dec 18 12:07:25 2015 +0000
Commit message:
cxmnh,ds;

Changed in this revision

C12832.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832.lib	Fri Dec 18 12:07:25 2015 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/chris/code/C12832/#7de323fa46fe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Dec 18 12:07:25 2015 +0000
@@ -0,0 +1,88 @@
+#include "mbed.h"
+#include "C12832.h"
+
+Ticker Tick;
+InterruptIn button1(p15);
+InterruptIn button2(p12);
+InterruptIn button3(p14);
+
+Serial pc(USBTX, USBRX);
+
+C12832 lcd(p5, p7, p6, p8, p11);
+
+float a;
+int msek;
+int sek;
+int min;
+int stund;
+bool mode;
+
+
+void zaehl()
+{
+    if(mode==true) {
+        msek++;
+        if(msek==100) {
+            sek++;
+            msek=0;
+            
+            pc.printf("Stu:%d  Min:%d  Sek:%d \n",stund, min, sek);
+        }
+
+        if(sek==60) {
+            min++;
+            sek=0;
+
+        }
+
+        if(min==60) {
+            stund++;
+            min=0;
+        }
+        if(stund==24) {
+            msek=0;
+            sek=0;
+            min=0;
+            stund=0;
+        }
+
+    }
+     
+}
+
+void on()
+{
+    mode=true;
+}
+
+void off()
+{
+    mode=false;
+}
+
+void reset()
+{
+    msek=0;
+    sek=0;
+    min=0;
+    stund=0;
+}
+
+int main()
+{
+    Tick.attach(&zaehl, 0.01);
+    button1.rise(&on);
+    button2.rise(&off);
+    button3.rise(&reset);
+
+    mode=false;
+    
+    lcd.cls();
+    lcd.locate(0,3);
+    
+    while(1) {
+            lcd.printf("Stu:%d  Min:%d  Sek:%d ",stund, min, sek);
+            lcd.locate(0,3);
+
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Dec 18 12:07:25 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4336505e4b1c
\ No newline at end of file