SPI,I2C,RTC
Dependencies: MFRC522_Updated ssd1306_library
main.cpp@2:8083cd0c48a8, 2020-05-19 (annotated)
- Committer:
- andres0705
- Date:
- Tue May 19 19:04:33 2020 +0000
- Revision:
- 2:8083cd0c48a8
- Parent:
- 1:fd4f40b923e7
- Child:
- 3:bd37bcc0ec09
agregue la libreria de la oled para probarla;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
20172573073 | 0:fbda9e7e9269 | 1 | #include "mbed.h" |
20172573073 | 1:fd4f40b923e7 | 2 | #include "stdio.h" |
20172573073 | 1:fd4f40b923e7 | 3 | #include "string.h" |
andres0705 | 2:8083cd0c48a8 | 4 | #include "ssd1306.h" |
andres0705 | 2:8083cd0c48a8 | 5 | SSD1306 lcd (I2C_SDA, I2C_SCL); |
20172573073 | 1:fd4f40b923e7 | 6 | Serial pc(USBTX, USBRX); |
20172573073 | 0:fbda9e7e9269 | 7 | |
20172573073 | 0:fbda9e7e9269 | 8 | int main() { |
20172573073 | 0:fbda9e7e9269 | 9 | set_time(1589850133); |
andres0705 | 2:8083cd0c48a8 | 10 | lcd.speed (SSD1306::Medium); |
andres0705 | 2:8083cd0c48a8 | 11 | |
andres0705 | 2:8083cd0c48a8 | 12 | lcd.init(); |
andres0705 | 2:8083cd0c48a8 | 13 | lcd.cls(); |
andres0705 | 2:8083cd0c48a8 | 14 | lcd.locate (3,1); |
andres0705 | 2:8083cd0c48a8 | 15 | lcd.printf ("Hello, world!"); |
andres0705 | 2:8083cd0c48a8 | 16 | lcd.line ( 6, 22, 114, 22, SSD1306::Normal); |
andres0705 | 2:8083cd0c48a8 | 17 | lcd.line (114, 22, 114, 33, SSD1306::Normal); |
andres0705 | 2:8083cd0c48a8 | 18 | lcd.line (114, 33, 6, 33, SSD1306::Normal); |
andres0705 | 2:8083cd0c48a8 | 19 | lcd.line ( 6, 33, 6, 22, SSD1306::Normal); |
andres0705 | 2:8083cd0c48a8 | 20 | lcd.fill (0, 0); |
20172573073 | 0:fbda9e7e9269 | 21 | while (true) { |
20172573073 | 0:fbda9e7e9269 | 22 | time_t seconds = time(NULL); |
20172573073 | 0:fbda9e7e9269 | 23 | |
20172573073 | 1:fd4f40b923e7 | 24 | pc.printf(" %u\n\r ", (unsigned int)seconds); |
20172573073 | 0:fbda9e7e9269 | 25 | |
20172573073 | 1:fd4f40b923e7 | 26 | pc.printf("fecha %s\n\r", ctime(&seconds)); |
20172573073 | 0:fbda9e7e9269 | 27 | |
20172573073 | 0:fbda9e7e9269 | 28 | |
20172573073 | 0:fbda9e7e9269 | 29 | wait(1); |
20172573073 | 0:fbda9e7e9269 | 30 | } |
20172573073 | 0:fbda9e7e9269 | 31 | } |