![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
L432KCIM
Diff: main.cpp
- Revision:
- 0:0881a71b392b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jan 13 06:56:27 2022 +0000 @@ -0,0 +1,39 @@ +#include "mbed.h" +#include "Serial.h" +Serial device(PA_2,PA_3); +DigitalOut led(LED1); + +char str[10]; + +void getC(){ + int i=0; + char command=device.getc(); + if(command=='A'||'a'){ + while(i<5){ + led=1; + wait(0.5); + i++; + } + }else if(command=='B'||'b'){ + while(i<5){ + led=1; + wait(1); + i++; + } + }else if(command=='C'||'c'){ + while(i<5){ + led=1; + wait(1.5); + i++; + } + } +} + + +int main(){ + device.baud(9600); + device.attach(getC,Serial::RxIrq); + while(1){ + } +} + \ No newline at end of file