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 #define BAUD_RATE 921600 00003 #define INITIATER 0 00004 00005 // http://mbed.org/platforms/FRDM-KL46Z/ 00006 00007 DigitalOut myled(LED_GREEN); 00008 Serial pc(USBTX, USBRX); 00009 Serial uart(PTE0, PTE1); 00010 00011 char num = 0; 00012 00013 void receiver_send() 00014 { 00015 while(1) { 00016 wait(1); 00017 uart.putc(num); 00018 num += 2; 00019 myled = !myled; 00020 } 00021 } 00022 00023 void send(char c) 00024 { 00025 uart.putc(c); 00026 } 00027 00028 void read() 00029 { 00030 myled = !myled; 00031 char c = uart.getc(); 00032 num += 2; 00033 // send(num); 00034 if (INITIATER) 00035 pc.printf("%d\n", c); 00036 } 00037 00038 int main() { 00039 pc.baud(BAUD_RATE); 00040 uart.baud(BAUD_RATE); 00041 00042 if (INITIATER) { 00043 uart.attach(read); 00044 num = 1; 00045 uart.putc(num); 00046 } else { 00047 num = 0; 00048 receiver_send(); 00049 } 00050 00051 pc.printf("Hello World\n"); 00052 00053 while (true) { 00054 wait(0.5); 00055 } 00056 }
Generated on Sat Aug 20 2022 08:40:56 by
1.7.2