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 // using 2 serial instances to workaround hand bug while using printf both inside and outside interrupt 00002 00003 #include "mbed.h" 00004 00005 Serial pc(USBTX, USBRX); // tx, rx 00006 Serial pc2(USBTX, USBRX); // tx, rx 00007 00008 // debugging LEDs 00009 DigitalOut interrupt(LED1); 00010 DigitalOut tx(LED4); 00011 00012 void handle() { 00013 char rx_byte = pc2.getc(); 00014 interrupt = !interrupt; 00015 } 00016 00017 int main() { 00018 pc2.attach(handle); 00019 00020 while (1) { 00021 // send a long string of bytes 00022 tx = 1; 00023 for (int i=0;i<20;i++) { 00024 printf("If I receive while transmitting this I will crash...\r\n"); 00025 } 00026 tx = 0; 00027 wait(1.0); 00028 } 00029 }
Generated on Sat Jul 16 2022 02:11:22 by
1.7.2