TEST_LP 1608

Dependencies:   mbed DS1302

Committer:
armandotill
Date:
Fri Nov 30 04:54:09 2018 +0000
Revision:
3:8c4b9d2adf7a
Parent:
2:10b51af4fb8c
test_DS1302

Who changed what in which revision?

UserRevisionLine numberNew contents of line
armandotill 3:8c4b9d2adf7a 1 #define SCLK p14
armandotill 3:8c4b9d2adf7a 2 #define IO p13
armandotill 3:8c4b9d2adf7a 3 #define CE p12
Sissors 0:5e6107966aba 4
Sissors 0:5e6107966aba 5 //Comment this line if the DS1302 is already running
Sissors 0:5e6107966aba 6 #define INITIAL_RUN
Sissors 0:5e6107966aba 7
Sissors 0:5e6107966aba 8 #include "mbed.h"
Sissors 0:5e6107966aba 9 #include "DS1302.h"
Sissors 0:5e6107966aba 10
Gijsvanoort 1:e747c4ea86e0 11 DS1302 clk(SCLK, IO, CE);
Sissors 0:5e6107966aba 12
Sissors 0:5e6107966aba 13 int main() {
Sissors 0:5e6107966aba 14 #ifdef INITIAL_RUN
armandotill 3:8c4b9d2adf7a 15 clk.set_time(1543510189);
Sissors 0:5e6107966aba 16 #endif
Sissors 0:5e6107966aba 17
Sissors 0:5e6107966aba 18 char storedByte = clk.recallByte(0);
armandotill 2:10b51af4fb8c 19 //printf("\r\nStored byte was %d, now increasing by one\r\n", storedByte);
Sissors 0:5e6107966aba 20 clk.storeByte(0, storedByte + 1);
Sissors 0:5e6107966aba 21
Sissors 0:5e6107966aba 22 while(1) {
Sissors 0:5e6107966aba 23 time_t seconds = clk.time(NULL);
armandotill 2:10b51af4fb8c 24 printf("Fecha - Hora = %s\r", ctime(&seconds));
Sissors 0:5e6107966aba 25 wait(1);
Sissors 0:5e6107966aba 26 }
Sissors 0:5e6107966aba 27 }