receive input from terminal to control the leds
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 00003 Serial pc(USBTX, USBRX); 00004 DigitalOut myled1(LED1), myled2(LED2); 00005 00006 int main() { 00007 00008 while(1) { 00009 char c = pc.getc(); 00010 if (c=='q'){ 00011 myled1 = 1; 00012 wait(0.2); 00013 myled1 = 0; 00014 wait(0.2); 00015 } 00016 00017 if (c=='w'){ 00018 myled2 = 1; 00019 wait(0.2); 00020 myled2 = 0; 00021 wait(0.2); 00022 } 00023 00024 } 00025 }
Generated on Wed Jul 20 2022 22:52:21 by
1.7.2