SPI,I2C,RTC
Dependencies: MFRC522_Updated ssd1306_library
main.cpp@7:6372f34c11d1, 2020-05-20 (annotated)
- Committer:
- andres0705
- Date:
- Wed May 20 01:38:01 2020 +0000
- Revision:
- 7:6372f34c11d1
- Parent:
- 6:820dac5cdd1e
- Child:
- 8:51c5c171bbf6
.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andres0705 | 7:6372f34c11d1 | 1 | #include "mbed.h" |
andres0705 | 7:6372f34c11d1 | 2 | #include "stdio.h" |
20172573073 | 1:fd4f40b923e7 | 3 | #include "string.h" |
andres0705 | 2:8083cd0c48a8 | 4 | #include "ssd1306.h" |
20172573073 | 3:bd37bcc0ec09 | 5 | SSD1306 lcd (D7, D6); |
20172573073 | 1:fd4f40b923e7 | 6 | Serial pc(USBTX, USBRX); |
20172573073 | 3:bd37bcc0ec09 | 7 | Ticker t; |
20172573073 | 3:bd37bcc0ec09 | 8 | int q=0; |
20172573073 | 3:bd37bcc0ec09 | 9 | void conteo() |
20172573073 | 3:bd37bcc0ec09 | 10 | { |
20172573073 | 3:bd37bcc0ec09 | 11 | q=q+1; |
20172573073 | 3:bd37bcc0ec09 | 12 | } |
20172573073 | 3:bd37bcc0ec09 | 13 | int main() |
20172573073 | 3:bd37bcc0ec09 | 14 | { |
20172573073 | 3:bd37bcc0ec09 | 15 | t.attach(&conteo,1); |
20172573073 | 3:bd37bcc0ec09 | 16 | q=1589916065; |
andres0705 | 6:820dac5cdd1e | 17 | lcd.init(); |
andres0705 | 2:8083cd0c48a8 | 18 | lcd.speed (SSD1306::Medium); |
20172573073 | 3:bd37bcc0ec09 | 19 | lcd.cls(); |
20172573073 | 3:bd37bcc0ec09 | 20 | lcd.locate (3,1); |
20172573073 | 5:e86f65d4cdf2 | 21 | lcd.printf ("Escaner RF"); |
20172573073 | 5:e86f65d4cdf2 | 22 | lcd.locate (4,1); |
20172573073 | 5:e86f65d4cdf2 | 23 | lcd.printf ("Andres Arevalo"); |
20172573073 | 5:e86f65d4cdf2 | 24 | lcd.locate (5,1); |
20172573073 | 5:e86f65d4cdf2 | 25 | lcd.printf ("Andres castano"); |
20172573073 | 4:500f1ba2d17a | 26 | lcd.redraw(); |
20172573073 | 5:e86f65d4cdf2 | 27 | wait(3); |
20172573073 | 5:e86f65d4cdf2 | 28 | lcd.redraw(); |
andres0705 | 6:820dac5cdd1e | 29 | |
andres0705 | 6:820dac5cdd1e | 30 | while (true) { |
andres0705 | 6:820dac5cdd1e | 31 | |
andres0705 | 6:820dac5cdd1e | 32 | lcd.redraw(); |
20172573073 | 3:bd37bcc0ec09 | 33 | set_time(q); |
20172573073 | 0:fbda9e7e9269 | 34 | time_t seconds = time(NULL); |
20172573073 | 3:bd37bcc0ec09 | 35 | |
20172573073 | 1:fd4f40b923e7 | 36 | pc.printf("fecha %s\n\r", ctime(&seconds)); |
20172573073 | 0:fbda9e7e9269 | 37 | |
20172573073 | 3:bd37bcc0ec09 | 38 | |
20172573073 | 0:fbda9e7e9269 | 39 | wait(1); |
20172573073 | 0:fbda9e7e9269 | 40 | } |
andres0705 | 6:820dac5cdd1e | 41 | } |