ELEC350 - Team Q / Mbed 2 deprecated OllyIsNotBright

Dependencies:   mbed

main.cpp

Committer:
osmith2
Date:
2017-12-23
Revision:
1:24717a795dc0
Parent:
0:7c0bfc9d2e16

File content as of revision 1:24717a795dc0:

#include "mbed.h"





Serial pc(USBTX, USBRX);



int year = 2017;
char month = 12;
char day = 25;
char hour = 23;
char minute = 28;

DigitalOut myled(LED1);

int main() {
    while(1) {
        myled = 1; // LED is ON
        wait(0.2); // 200 ms
        myled = 0; // LED is OFF
        wait(1.0); // 1 sec
        
        //date
        pc.printf("Year: %d\n", year);
        pc.printf("Month: %d\n", month);
        pc.printf("Day: %d\n", day);
        //time
        pc.printf("Hour: %d\n", hour);
        pc.printf("Minute: %d\n", minute);
        
        
        // SOOooooo, am I retarded or can we not just do this?
        pc.printf("Date and time: %d.%d.%d.%d.%d \n", year, month, day, hour, minute);
        pc.printf("Merry christmas!\n");
        
        
        
        char buffer [50];
        int n; 
        //a=5, b=3;
        n=sprintf (buffer, "%d.%d.%d¦%d:%d", year, month, day, hour, minute);
        pc.printf ("[%s] is a string %d chars long\n",buffer,n);
        return 0;
        
        
        /*
        char rtard [50];
        int m, c=5, d=3;
        m=sprintf (rtard, "Duo %d plus %d is %d", c, d, c+d);
        pc.printf ("[%s] is a string %d chars long\n",rtard,n);
        return 0;        
        */
        
        /*
        char datboi [100];
        int o;
        o = sprintf (datboi, "Date and Time: %d.%d \n", year, month);
        pc.printf ("[%s] is a string chars long\n",datboi, n);
        return 0;
        */
        
    }
}