180sec down timer for an instant noodle cooking.

Dependencies:   C12832_lcd LCD_fonts mbed

Ra-men timer

This program works on 1768/11U24 mbed.

Files at this revision

API Documentation at this revision

Comitter:
mio
Date:
Fri Jun 21 14:28:04 2013 +0000
Commit message:
first release.

Changed in this revision

C12832_lcd.lib Show annotated file Show diff for this revision Revisions of this file
LCD_fonts.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_lcd.lib	Fri Jun 21 14:28:04 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/dreschpe/code/C12832_lcd/#c9afe58d786a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LCD_fonts.lib	Fri Jun 21 14:28:04 2013 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/dreschpe/code/LCD_fonts/#d0b7d7bf1f56
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jun 21 14:28:04 2013 +0000
@@ -0,0 +1,71 @@
+#include "mbed.h"
+#include "C12832_lcd.h"
+#include "Arial24x23.h"
+
+Ticker t ;
+C12832_LCD lcd;
+PwmOut buzzer(p26);
+InterruptIn left(p13),right(p16),center(p14);
+DigitalOut l1(LED1),l2(LED2),l3(LED3),l4(LED4);
+
+int last = 180;
+int i = 0 ;
+
+
+void printlast(){
+    lcd.invert(0);
+    lcd.locate(8,2);
+    lcd.printf(" %02d:%02d ",(int)last/60,(int)last%60);
+}
+
+
+void pushleft() {
+    if (last > 10) {
+        last-=10 ;
+    }
+    printlast();
+}
+
+void pushright() {
+    last+=10 ;
+    printlast();
+}
+
+void pushcenter() {
+    buzzer = 0;
+}
+
+void onesec()
+{
+    if (last > 0) {
+        l1 = l2 = l3 = l4 = 0 ;
+        buzzer = 0 ;
+        if (--last == 0) {
+            buzzer = 0.5;
+        }
+        printlast();
+    } else {
+        lcd.invert(i);
+        l1 = l3 = i ;
+        i = i ? 0 : 1 ;
+        l2 = l4 = i ;
+    }
+}
+
+int main()
+{
+    buzzer = 0 ;
+    lcd.cls();
+    lcd.set_font((unsigned char *)Arial24x23);
+    l1 = 0 ;
+    l2 = 0 ;
+    left.rise(&pushleft);
+    right.rise(&pushright);
+    center.rise(&pushcenter);
+    buzzer.period_us(1000);    
+    t.attach(&onesec,1.0);
+
+    while(true) {   // this is the third thread
+        sleep();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Jun 21 14:28:04 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17
\ No newline at end of file