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 DigitalOut led_red(LED_RED); 00004 DigitalOut led_green(LED_GREEN); 00005 DigitalIn sw2(SW2); 00006 DigitalIn sw3(SW3); 00007 Serial pc(USBTX, USBRX); 00008 00009 void check_sw2(void) 00010 { 00011 if (sw2 == 0) { 00012 pc.printf("SW2 button pressed. \n"); 00013 led_red = 0; 00014 led_green = 1; 00015 } 00016 } 00017 00018 void check_sw3(void) 00019 { 00020 if (sw3 == 0) { 00021 pc.printf("SW3 button pressed. \n"); 00022 led_green = 0; 00023 led_red = 1; 00024 pc.printf("5 characters will be echoed. Start typing. \n"); 00025 for (uint32_t i = 0; i < 5; i++) { 00026 pc.putc(pc.getc()); 00027 } 00028 pc.putc(13); /* CR */ 00029 pc.putc(10); /* LF */ 00030 } 00031 } 00032 00033 int main() { 00034 led_green = 1; 00035 led_red = 1; 00036 pc.baud(115200); 00037 pc.printf("Hello World from FRDM-K64F board.\n"); 00038 00039 while (true) { 00040 check_sw2(); 00041 check_sw3(); 00042 wait(0.3); 00043 } 00044 }
Generated on Fri Jul 22 2022 22:01:52 by
1.7.2