SPI,I2C,RTC

Dependencies:   MFRC522_Updated ssd1306_library

main.cpp

Committer:
andres0705
Date:
2020-05-19
Revision:
2:8083cd0c48a8
Parent:
1:fd4f40b923e7
Child:
3:bd37bcc0ec09

File content as of revision 2:8083cd0c48a8:

#include "mbed.h"
#include "stdio.h"
#include "string.h"
#include "ssd1306.h"
SSD1306 lcd (I2C_SDA, I2C_SCL); 
Serial pc(USBTX, USBRX);

int main() {
    set_time(1589850133);  
    lcd.speed (SSD1306::Medium);
    
    lcd.init();                   
    lcd.cls();                    
    lcd.locate (3,1);             
    lcd.printf ("Hello, world!"); 
    lcd.line (  6, 22, 114, 22, SSD1306::Normal); 
    lcd.line (114, 22, 114, 33, SSD1306::Normal); 
    lcd.line (114, 33,   6, 33, SSD1306::Normal); 
    lcd.line (  6, 33,   6, 22, SSD1306::Normal); 
    lcd.fill (0, 0);            
    while (true) {
        time_t seconds = time(NULL);
        
        pc.printf(" %u\n\r ", (unsigned int)seconds);
        
        pc.printf("fecha  %s\n\r", ctime(&seconds));

        
        wait(1);
    }
}