SPI,I2C,RTC

Dependencies:   MFRC522_Updated ssd1306_library

main.cpp

Committer:
20172573073
Date:
2020-05-20
Revision:
8:51c5c171bbf6
Parent:
7:6372f34c11d1
Child:
9:935f87e2299d

File content as of revision 8:51c5c171bbf6:

#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.init();
    lcd.speed (SSD1306::Medium);
    lcd.cls();
    lcd.locate (3,1);
    lcd.printf ("Escaner RF");
    lcd.locate (4,1);
    lcd.printf ("Andres Arevalo");
    lcd.locate (5,1);
    lcd.printf ("Andres castano");
    lcd.redraw();
    wait(3);
    lcd.redraw();

    while (true) {

        lcd.redraw();
        set_time(q);
        time_t seconds = time(NULL);

        char buffer2[32];
        strftime(buffer2, 32, "%m/%d/%y", localtime(&seconds));
        pc.printf("%s", buffer2);
        char buffer1[32];
        strftime(buffer1, 32, "%H:%M:%S", localtime(&seconds));
        pc.printf(" , %s\n\r", buffer1);
        

        wait(1);
    }
}