dc

Dependencies:   mbed nRF51822

main.cpp

Committer:
borlanic
Date:
2018-03-20
Revision:
0:e97dc3733638
Child:
1:aecce7b83157

File content as of revision 0:e97dc3733638:

#include <cstdlib>
#include <mbed.h>
#include <math.h>


Serial pc(USBTX, USBRX); // tx, rx
Serial device(PA_0, PA_1);  // tx, rx
DigitalOut myled(LED1);

int main()
{

    device.baud(9600);
    //device.printf("ciao\n");
    pc.printf("cazzo\n");
    int i = 0;

    myled = 0;

    while(1) {
        if(pc.readable()) {
            device.putc(pc.getc());
            char a = pc.getc();

            if(a == "1") {
                myled = 0;
            } else {
                myled = 1;
            }
        }
        if(device.readable()) {
            pc.putc(device.getc());
        }
        device.printf("cazzo %d\r\n",i);
        i++;
        wait(1);

    }
}