i
Dependencies: mbed
Revision 2:1b22d1b7f25e, committed 2021-12-14
- Comitter:
- davidmateos
- Date:
- Tue Dec 14 14:14:27 2021 +0000
- Parent:
- 1:fd8f7f939d86
- Commit message:
- ghhfthm
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Dec 11 12:14:53 2020 +0000 +++ b/main.cpp Tue Dec 14 14:14:27 2021 +0000 @@ -1,18 +1,29 @@ #include "mbed.h" +Serial pc(USBTX, USBRX); // tx, rx DigitalOut rele(A5); DigitalOut led(LED1); +char dato; + int main() -{ +{ pc.baud(115200); + pc.printf("empieza"); while(1) { - rele=1; - led=1; - wait(1.0); - rele=0; - led=0; - wait(1.0); + if(pc.readable()) { + dato=(pc.getc()); + if(dato=='1') { + rele=1; + pc.printf("encendidi"); + } + if(dato=='0') { + rele=0; + pc.printf("apagado"); + } + } + + wait(0.01); } }