SPI,I2C,RTC
Dependencies: MFRC522_Updated ssd1306_library
main.cpp@0:fbda9e7e9269, 2020-05-19 (annotated)
- Committer:
- 20172573073
- Date:
- Tue May 19 18:02:40 2020 +0000
- Revision:
- 0:fbda9e7e9269
- Child:
- 1:fd4f40b923e7
SPI,I2C,RTC
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
20172573073 | 0:fbda9e7e9269 | 1 | #include "mbed.h" |
20172573073 | 0:fbda9e7e9269 | 2 | |
20172573073 | 0:fbda9e7e9269 | 3 | int main() { |
20172573073 | 0:fbda9e7e9269 | 4 | set_time(1589850133); |
20172573073 | 0:fbda9e7e9269 | 5 | |
20172573073 | 0:fbda9e7e9269 | 6 | while (true) { |
20172573073 | 0:fbda9e7e9269 | 7 | time_t seconds = time(NULL); |
20172573073 | 0:fbda9e7e9269 | 8 | |
20172573073 | 0:fbda9e7e9269 | 9 | printf(" %u\n\r ", (unsigned int)seconds); |
20172573073 | 0:fbda9e7e9269 | 10 | |
20172573073 | 0:fbda9e7e9269 | 11 | printf("fecha %s\n\r", ctime(&seconds)); |
20172573073 | 0:fbda9e7e9269 | 12 | |
20172573073 | 0:fbda9e7e9269 | 13 | char buffer[32]; |
20172573073 | 0:fbda9e7e9269 | 14 | strftime(buffer, 32, "%I:%M %p\n\r", localtime(&seconds)); |
20172573073 | 0:fbda9e7e9269 | 15 | printf("Time as a custom formatted string = %s\n\r", buffer); |
20172573073 | 0:fbda9e7e9269 | 16 | |
20172573073 | 0:fbda9e7e9269 | 17 | wait(1); |
20172573073 | 0:fbda9e7e9269 | 18 | } |
20172573073 | 0:fbda9e7e9269 | 19 | } |