Armando Hernández
/
DS1302_HelloWorld
TEST_LP 1608
main.cpp
- Committer:
- armandotill
- Date:
- 2018-11-30
- Revision:
- 2:10b51af4fb8c
- Parent:
- 1:e747c4ea86e0
- Child:
- 3:8c4b9d2adf7a
File content as of revision 2:10b51af4fb8c:
#define SCLK p22 #define IO p23 #define CE p24 //Comment this line if the DS1302 is already running #define INITIAL_RUN #include "mbed.h" #include "DS1302.h" DS1302 clk(SCLK, IO, CE); int main() { #ifdef INITIAL_RUN clk.set_time(2056729737); #endif char storedByte = clk.recallByte(0); //printf("\r\nStored byte was %d, now increasing by one\r\n", storedByte); clk.storeByte(0, storedByte + 1); while(1) { time_t seconds = clk.time(NULL); printf("Fecha - Hora = %s\r", ctime(&seconds)); wait(1); } }