SPI,I2C,RTC

Dependencies:   MFRC522_Updated ssd1306_library

main.cpp

Committer:
20172573073
Date:
2020-05-20
Revision:
4:500f1ba2d17a
Parent:
3:bd37bcc0ec09
Child:
5:e86f65d4cdf2

File content as of revision 4:500f1ba2d17a:

#include "mbed.h"
#include "stdio.h"
#include "string.h"
#include "ssd1306.h"
SSD1306 lcd (D7, D6);
Serial pc(USBTX, USBRX);
Ticker t;
int q=0;
void conteo()
{
    q=q+1;
}
int main()
{
    t.attach(&conteo,1);
    q=1589916065;

    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);
    lcd.redraw();
    while (true) {
        set_time(q);
        time_t seconds = time(NULL);

        pc.printf(" %u\n\r ", (unsigned int)seconds);

        pc.printf("fecha  %s\n\r", ctime(&seconds));


        wait(1);
    }
}