STDin and STDout example

Dependencies:   mbed

main.cpp

Committer:
lmottola
Date:
2019-03-19
Revision:
2:677b83cb846c
Parent:
1:2f9d56e97f30

File content as of revision 2:677b83cb846c:

#include "mbed.h"

Serial pc(USBTX, USBRX);

int main() {
    
    char buffer[128];
    pc.printf("Starting..\n");
//    int count = 0;

    while (1) {
        pc.gets(buffer, 4);
        pc.printf("I got '%s'\n", buffer);
 
        // Alternate version to process data over serial from a host program...    
//        pc.printf("The counter is '%d'\n", count);
//        count++;
//        wait (1);
    }
}