Kei Ohta
/
USB_Serial
for TSUBAME
Revision 0:522b4f6b8f49, committed 2014-07-03
- Comitter:
- ohtake_i
- Date:
- Thu Jul 03 01:50:47 2014 +0000
- Commit message:
- for TSUBAME
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 |
diff -r 000000000000 -r 522b4f6b8f49 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jul 03 01:50:47 2014 +0000 @@ -0,0 +1,44 @@ +#include "mbed.h"; + +Serial pc(USBTX, USBRX); // tx, rx +DigitalOut debug1(LED1); + +// display character from pc using interrupt +void rxCallBack(void) { + debug1 = !debug1; + pc.putc(pc.getc()); +} + +int main() { + + // define interrupt + pc.attach(rxCallBack, Serial::RxIrq); + + char TSUBAME[] = {'T','S','U','B','A','M','E',' '}; // 8 + char data[] = {'8','8',' ','2','0',' ','C','2',' ','9','A',' ','0','1',' ','0','1',' ','2','E',' ','2','E',' ','1','8',' ','4','3',' ','8','7',' ','F','8',' ','0','9',' ','0','9',' ','0','0',' ','0','1',' '}; // 32 + char MESSAGE[] = {'H','I',' ','H','I',' ','D','E',' ','J','Q','1','Y','T','C',' '}; // 15 + + while(1) + { + int i; + for(i=0; i<8; i++) + { + pc.putc(TSUBAME[i]); + pc.printf("\r\n"); + wait(0.1); + } + for(i=0; i<48; i++) + { + pc.putc(data[i]); + pc.printf("\r\n"); + wait(0.1); + } + for(i=0; i<16; i++) + { + pc.putc(MESSAGE[i]); + pc.printf("\r\n"); + wait(0.1); + } + } +} +
diff -r 000000000000 -r 522b4f6b8f49 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Jul 03 01:50:47 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17 \ No newline at end of file