V3.0
Dependencies: mbed
Fork of Serial_STX3_2 by
Revision 1:405cd679275c, committed 2017-10-25
- Comitter:
- Sumobot
- Date:
- Wed Oct 25 21:24:06 2017 +0000
- Parent:
- 0:c2333cdfbcfa
- Commit message:
- Pull Up; RX-TX
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r c2333cdfbcfa -r 405cd679275c main.cpp --- a/main.cpp Wed Oct 25 18:37:07 2017 +0000 +++ b/main.cpp Wed Oct 25 21:24:06 2017 +0000 @@ -1,30 +1,37 @@ #include "mbed.h" + Serial pc(USBTX, USBRX, 9600); // tx, rx Serial device(p9, p10, 9600); // tx, rx -DigitalOut RTS(p7); -DigitalIn CTS(p8); -int flag=1; +DigitalOut RTS(p7, 1); +DigitalIn CTS(p8, PullUp); +int flag=1; +//Timer t; int main() { - pc.printf("Inicio de Programa \n\r"); - wait(.1); - pc.printf("El valor de CTS inicial es %d\n\r",CTS.read()); + //CTS.mode(PullUp); + wait(5); + pc.printf("El valor de CTS 1 es %d\n\r",CTS.read()); + pc.printf("El valor de RTS 1 es %d\n\r",RTS.read()); RTS=0; while(flag==1){ + //t.start(); flag=CTS.read(); - wait(.1); + //wait(.1); pc.printf("El valor de flag es %d\n\r", flag); } - /*device.putc(0XAA); + wait(.1); + device.putc(0XAA); device.putc(0X05); - device.putc(0X07); - device.putc(0X66); - device.putc(0XB0);*/ + device.putc(0X04); + device.putc(0XFD); + device.putc(0X82); wait(.1); RTS=1; - wait(.1); - while(1) { - pc.putc(device.getc()); + //pc.printf("El tiempo es %f\n\r", t.read()); + while(1) { + if(device.readable()) { + pc.putc(device.getc()); + } } } \ No newline at end of file