
prueba 001
main.cpp
- Committer:
- DiegoColl
- Date:
- 2017-05-31
- Revision:
- 0:f5375e67929f
- Child:
- 1:fbf9b50fe4f0
File content as of revision 0:f5375e67929f:
#include "mbed.h" //DigitalOut myled(LED1); Serial pc(USBTX, USBRX); //char cadena[32]=""; char buffer[32]=""; //char ID[2]="C1",ST[2]="OK",OR[2]="",RP[2]="",QY[2]="",AK[2]=""; char IDs[2],STs[2],ACs[2],AKs[2]; char * pch; int i=0; void borrar_buffer(char *cadena){ for(i=0;i<31;i++){ cadena[i]=0x00; } //pc.printf("\nbuffer: %s", buffer); } void interrup(){ char c; i=0; c=pc.getc(); //pc.putc(c); if(c=='<'){ //pc.putc(c); while(c!='>'){ c=pc.getc(); if(c!='>'){ //pc.putc(c); buffer[i++]=c; } } //pc.puts(buffer); i=0; pch=strtok(buffer,";"); while(pch != NULL){ //pc.printf("\n%s",pch); pch=strtok(NULL, ";"); if(i==0) strcpy(IDs,pch); if(i==1) STs=pch; if(i==2) ACs=pch; if(i==3) AKs=pch; i++; } borrar_buffer(buffer); } } int main() { pc.printf("Inicio de programa\n"); pc.attach(&interrup); while(1){ } }