![](/media/cache/profiles/0738069b244a1c43c83112b735140a16.50x50_q85.jpg)
180sec down timer for an instant noodle cooking.
Dependencies: C12832_lcd LCD_fonts mbed
Ra-men timer
- For mbed application board /cookbook/mbed-application-board
- Push JoyStick Right - Extend 10second
- Push JoyStick Center - Stop Buzzer
This program works on 1768/11U24 mbed.
Revision 0:901b2e92426d, committed 2013-06-21
- Comitter:
- mio
- Date:
- Fri Jun 21 14:28:04 2013 +0000
- Commit message:
- first release.
Changed in this revision
diff -r 000000000000 -r 901b2e92426d C12832_lcd.lib --- /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
diff -r 000000000000 -r 901b2e92426d LCD_fonts.lib --- /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
diff -r 000000000000 -r 901b2e92426d main.cpp --- /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(); + } +}
diff -r 000000000000 -r 901b2e92426d mbed.bld --- /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