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: RTC-DS1307 TextLCD mbed
Fork of Rtc_Ds1307_Sample by
Revision 0:431183c5b136, committed 2013-06-02
- Comitter:
- leihen
- Date:
- Sun Jun 02 18:57:52 2013 +0000
- Child:
- 1:6dbe51fe0737
- Commit message:
- First complete Version. Untested.
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RTC-DS1307.lib Sun Jun 02 18:57:52 2013 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/leihen/code/RTC-DS1307/#64274190e842
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sun Jun 02 18:57:52 2013 +0000
@@ -0,0 +1,56 @@
+#include "mbed.h"
+#include "Rtc_Ds1307.h"
+
+DigitalOut myled(LED1);
+
+Rtc_Ds1307 rtc(p28, p27);
+
+Serial pc(USBTX, USBRX, "pc");
+
+char buffer[128];
+int readptr = 0;
+int main() {
+ char c;
+ pc.printf("Good morning Henry\n");
+ Time tm = {};
+
+ while(1) {
+ pc.printf("*************************************\n");
+ pc.printf("* Menu for RTC Test : *\n");
+ pc.printf("* read - reads the clock *\n");
+ pc.printf("* start - start the clock *\n");
+ pc.printf("* stop - stop the clock *\n");
+ pc.printf(" write - write the clock *\n");
+ pc.printf("*************************************\n");
+
+ while( (c = pc.getc()) != '\n') {
+ buffer[readptr++] = c;
+ }
+ buffer[readptr++] = 0;
+ if (strncmp(buffer, "read", 4) == 0) {
+ // perform read
+ pc.printf("Performing read operation\n");
+ if (rtc.getTime(tm) ) {
+ pc.printf("The current time is : %02d:%02d:%02d\n", tm.hour, tm.min, tm.sec);
+ }
+
+ }
+ else if (strncmp(buffer, "write", 5) == 0) {
+ // perform write
+ pc.printf("Performing write operation\n");
+ }
+ else if (strncmp(buffer, "start", 5) == 0) {
+ // start
+ pc.printf("Performing start operation\n");
+ }
+ else if (strncmp(buffer, "stop", 4) == 0) {
+ // stop
+ pc.printf("Performing stop operation\n");
+ }
+ else {
+ pc.printf("syntax error\n");
+ }
+ readptr = 0;
+ pc.printf("\n\n\n");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Jun 02 18:57:52 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17 \ No newline at end of file
