Simple example of a serial port communicating with another serial port

Dependencies:   mbed

main.cpp

Committer:
simon
Date:
2011-02-13
Revision:
0:3c9dd1f868aa

File content as of revision 0:3c9dd1f868aa:

// example showing sending/receiving character

#include "mbed.h"

// connect p9 to p14 with a wire!
Serial out(p9, NC);
Serial in(NC, p14);

DigitalOut led(LED1);

int main() {
    out.putc('h');
    out.putc('i');
    char c1 = in.getc();
    char c2 = in.getc();
    
    led = 1;
    printf("c1: %c, c2: %c\n", c1, c2); 
}