
For making a small update
Fork of DS1302_HelloWorld by
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #define SCLK PTC5 00002 #define IO PTC4 00003 #define CE PTC3 00004 00005 //Comment this line if the DS1302 is already running 00006 #define INITIAL_RUN 00007 00008 #include "mbed.h" 00009 #include "DS1302.h" 00010 00011 DS1302 clk(SCLK, IO, CE); 00012 00013 int main() { 00014 #ifdef INITIAL_RUN 00015 clk.set_time(1256729737); 00016 #endif 00017 00018 char storedByte = clk.recallByte(0); 00019 printf("\r\nStored byte was %d, now increasing by one\r\n", storedByte); 00020 clk.storeByte(0, storedByte + 1); 00021 00022 while(1) { 00023 time_t seconds = clk.time(NULL); 00024 printf("Time as a basic string = %s\r", ctime(&seconds)); 00025 wait(1); 00026 } 00027 }
Generated on Thu Jul 14 2022 21:40:43 by
