L432KCIM

Dependencies:   mbed

main.cpp

Committer:
Takagisyuiti
Date:
2022-01-13
Revision:
0:0881a71b392b

File content as of revision 0:0881a71b392b:

#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){
    }
}