V3.0

Dependencies:   mbed

Fork of Serial_STX3_2 by UPAEP_AztechSat-1_Payloads

main.cpp

Committer:
Sumobot
Date:
2017-10-25
Revision:
1:405cd679275c
Parent:
0:c2333cdfbcfa

File content as of revision 1:405cd679275c:

#include "mbed.h"


Serial pc(USBTX, USBRX, 9600); // tx, rx
Serial device(p9, p10, 9600);  // tx, rx
DigitalOut RTS(p7, 1);
DigitalIn CTS(p8, PullUp);
int flag=1;
//Timer t;

int main() {
    //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);
        pc.printf("El valor de flag es %d\n\r", flag);
        }
        wait(.1);
        device.putc(0XAA);
        device.putc(0X05);
        device.putc(0X04);
        device.putc(0XFD);
        device.putc(0X82);
        wait(.1);
        RTS=1;
        //pc.printf("El tiempo es %f\n\r", t.read());
        while(1) {
        if(device.readable()) {
            pc.putc(device.getc());
            }
    }
}