Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MaxSonar RTC-DS1307 TextLCD mbed
main.cpp
- Committer:
- SausageSausage
- Date:
- 2017-05-25
- Revision:
- 1:aa2b8929a968
- Parent:
- 0:514ef400f75b
- Child:
- 2:d3a3a15016f3
File content as of revision 1:aa2b8929a968:
#include "mbed.h"
#include "TextLCD.h"
#include "Rtc_Ds1307.h"
Rtc_Ds1307 rtc(PTE0, PTE1);
DigitalOut r(LED1);
TextLCD lcd(PTE5, PTE4, PTE3, PTE2, PTB11, PTB10); // rs, e, d4-d7
Serial pc(USBTX, USBRX);
Rtc_Ds1307::Time_rtc tim = {};
void displayTime();
int main() {
Ticker cloo;
rtc.startClock();
cloo.attach(&displayTime, 1);
while(1){
r = !r;
wait(0.2);
}
}
void displayTime(){
Rtc_Ds1307::Time_rtc tm = tim;
if (rtc.getTime(tm) ) {
lcd.cls();
lcd.printf("The time is :\n%02d:%02d:%02d", tm.hour, tm.min, tm.sec);
}
}