Marlon Fulla / Mbed 2 deprecated 2015NOV21_XBEETESTROUT

Dependencies:   mbed

Fork of 2014ENE20_XBEETESTROUT by Marlon Fulla

main.cpp

Committer:
marlonfulla
Date:
2014-01-21
Revision:
0:681c5f49ef09
Child:
1:273b1f91d518

File content as of revision 0:681c5f49ef09:

#include "mbed.h"
//#include "SDFileSystem.h"
//#include <iostream>
#include <string>
//using namespace std;


Serial xbee(USBTX,USBRX);

string caracter,tira;
int npack,delay,ncharacters;
char read[64];

int main()
{

    xbee.baud(115200);
    caracter="A";
    tira="";

    while(1) {
//        cin>>caracteres;
/*        xbee.scanf("%d",caracteres);
  */          

        xbee.scanf("%s",read);
        ncharacters=atoi(read);
    
        for(int s=1;  s<=ncharacters ;s++) {
            tira=tira.append(caracter);
        }
  

        xbee.scanf("%s",read);
        npack=atoi(read);
        xbee.scanf("%s",read);
        delay=atoi(read);

//        cin>>recibido;
//        cin>>delay;
         
        for(int i=1;  i<=npack ;i++) {
           //cout<<tira<<'\n';
           xbee.printf("%s",tira);
           wait_us(delay);
        }

           xbee.printf("D");
           tira="";  

    }

}