Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 00003 RawSerial pc(USBTX, USBRX); 00004 RawSerial dev(p13,p14); 00005 DigitalOut led1(LED1); 00006 DigitalOut led4(LED4); 00007 00008 void dev_recv() 00009 { 00010 led1 = !led1; 00011 while(dev.readable()) { 00012 pc.putc(dev.getc()); 00013 } 00014 } 00015 00016 void pc_recv() 00017 { 00018 led4 = !led4; 00019 char x; 00020 while(pc.readable()) { 00021 x=pc.getc(); 00022 dev.putc(x); 00023 pc.putc(x); //echo back so that you can see what you are typing! 00024 } 00025 } 00026 00027 int main() 00028 { 00029 pc.baud(9600); 00030 dev.baud(9600); 00031 00032 pc.attach(&pc_recv, Serial::RxIrq); 00033 dev.attach(&dev_recv, Serial::RxIrq); 00034 00035 while(1) { 00036 sleep(); 00037 } 00038 }
Generated on Sun Jul 17 2022 06:33:33 by
1.7.2