UART connection demo.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 Serial device(p9, p10);  // tx, rx
00004 
00005 int main() {
00006     device.baud(19200);
00007     device.printf("?");
00008     
00009     int i;
00010     for (i = 0; i < 20; i++) {
00011         device.printf("<NUMK VAL=%d>kaime no zikko'u de_su\r", i + 1);        
00012         for (;;) {
00013             if(device.readable()) {
00014                 if (device.getc() == '>') {
00015                     break;
00016                 }
00017             }
00018             wait(0.5);
00019         }
00020     }
00021     device.printf("owari de_su\r");
00022 }