シリアル通信のテスト用

Dependencies:   mbed

main.cpp

Committer:
nissin_2411
Date:
2016-09-14
Revision:
0:0eb43c144d1b

File content as of revision 0:0eb43c144d1b:

#include "mbed.h"
 
Serial pc(USBTX, USBRX); // tx, rx
Serial serialPin(dp16,dp15);

int main() {
    pc.baud(9600);
    serialPin.baud(9600);
    pc.printf("Hello World!");
    int num;
    while(1) {
        num=serialPin.getc();
        pc.putc(num);
        if(num==1){
            pc.printf("get1");
    }
    if(num==0){
        pc.printf("get0");
        }
        }
}