Configurable countdown timer
Dependencies: mbed PinDetect TextLCD
Diff: main.cpp
- Revision:
- 1:0ed57c2fd528
- Parent:
- 0:95d8c08cb5d4
- Child:
- 2:ecbc6a14824c
--- a/main.cpp Sun May 24 22:08:33 2020 +0000 +++ b/main.cpp Sun May 24 23:02:30 2020 +0000 @@ -1,12 +1,38 @@ #include "mbed.h" - +#include "TextLCD.h" + DigitalOut myled(LED1); + +//TextLCD(PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7, LCDType type = LCD16x2); +// Note: VCC=5V, V0=0V, via 330 resistor) +TextLCD lcd(p15, p16, p17, p18, p19, p20); + +DigitalOut VO(p21); // pin put low +DigitalOut RW(p22); // pin put low + +int i = 0; -int main() { +void count() { + lcd.locate (0,1); + lcd.printf("%d",i); + i++; +} + +int main () { + + VO = 0; + RW = 0; + + // Clean screen + lcd.cls(); + + lcd.printf("Hello World!"); + while(1) { myled = 1; - wait(0.2); + wait(0.5); myled = 0; - wait(0.2); - } + wait(0.5); + count(); + } } \ No newline at end of file