UART connection demo.

Dependencies:   mbed

main.cpp

Committer:
alaif
Date:
2012-01-25
Revision:
0:c00df3e62680

File content as of revision 0:c00df3e62680:

#include "mbed.h"

Serial device(p9, p10);  // tx, rx

int main() {
    device.baud(19200);
    device.printf("?");
    
    int i;
    for (i = 0; i < 20; i++) {
        device.printf("<NUMK VAL=%d>kaime no zikko'u de_su\r", i + 1);        
        for (;;) {
            if(device.readable()) {
                if (device.getc() == '>') {
                    break;
                }
            }
            wait(0.5);
        }
    }
    device.printf("owari de_su\r");
}