シリアル通信のテスト用
Dependencies: mbed
Revision 0:0eb43c144d1b, committed 2016-09-14
- Comitter:
- nissin_2411
- Date:
- Wed Sep 14 15:38:51 2016 +0000
- Commit message:
- serial
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Sep 14 15:38:51 2016 +0000 @@ -0,0 +1,21 @@ +#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"); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Sep 14 15:38:51 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7cff1c4259d7 \ No newline at end of file