Configurable countdown timer

Dependencies:   mbed PinDetect TextLCD

main.cpp

Committer:
MarceloSalazar
Date:
2020-05-24
Revision:
1:0ed57c2fd528
Parent:
0:95d8c08cb5d4
Child:
2:ecbc6a14824c

File content as of revision 1:0ed57c2fd528:

#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;
 
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.5);
        myled = 0;
        wait(0.5);
        count(); 
   }
}