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.
Dependencies: mbed
main.cpp
00001 #include "mbed.h" 00002 00003 //------------------------------------ 00004 // Hyperterminal configuration 00005 // 9600 bauds, 8-bit data, no parity 00006 //------------------------------------ 00007 00008 Serial pc(SERIAL_TX, SERIAL_RX); 00009 00010 DigitalOut myled(LED1); 00011 00012 int main() 00013 { 00014 int i = 0; 00015 uint8_t state=0; 00016 pc.printf("Hello World !\n"); 00017 while(1) { 00018 wait(1); 00019 //pc.printf("This program runs since %d seconds.\n", i++); 00020 uint8_t size[10]; 00021 if(pc.readable()) { 00022 00023 size[i] = pc.getc(); 00024 00025 if(i >= 10) 00026 { 00027 i=0; 00028 pc.printf("overflow\n"); 00029 } 00030 else 00031 { 00032 i++; 00033 } 00034 00035 state =1; 00036 } 00037 else 00038 { 00039 if(state ==1) 00040 { 00041 pc.printf("%s\n",size); 00042 state =0; 00043 } 00044 } 00045 myled = !myled; 00046 } 00047 }
Generated on Thu Aug 11 2022 05:07:51 by
1.7.2