RTC _test
Dependencies: DS1307 USBDevice mbed
Revision 0:fa8339ae3125, committed 2015-04-18
- Comitter:
- seedteam20
- Date:
- Sat Apr 18 01:14:26 2015 +0000
- Commit message:
- sad
Changed in this revision
diff -r 000000000000 -r fa8339ae3125 DS1307.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DS1307.lib Sat Apr 18 01:14:26 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/harrypowers/code/DS1307/#c3e4da8feb10
diff -r 000000000000 -r fa8339ae3125 USBDevice.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBDevice.lib Sat Apr 18 01:14:26 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/USBDevice/#0ca6eeb54b97
diff -r 000000000000 -r fa8339ae3125 main_rtc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main_rtc.cpp Sat Apr 18 01:14:26 2015 +0000 @@ -0,0 +1,39 @@ +#include "ds1307.h" +#include "mbed.h" +#include "USBSerial.h" + +USBSerial pc; + +#define SDA P0_5 +#define SCL P0_4 + +DS1307 rtc(SDA,SCL); // start DS1307 class and give it pins for connections of the DS1307 device + + + +int sec = 24; // 24 ssec +int min = 12; // 12 min +int hours = 13; // 8 pm +int day = 6; // Friday +int date = 20; // April 17 +int month = 4; +int year = 15; // 2025 + // set time to these values on the ds1307 connected device + +DigitalOut POWER(P1_3); //drive low to activate pins + +int main() { + + POWER.write(1); + + rtc.settime( sec, min, hours, day, date, month, year); + + while(1){ + + rtc.gettime( &sec, &min, &hours, &day, &date, &month, &year); + + pc.printf("%.2d:%.2d:%.2d\r\n",hours,min,sec); + + wait(3); + } + } \ No newline at end of file
diff -r 000000000000 -r fa8339ae3125 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Apr 18 01:14:26 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa \ No newline at end of file