Peter's version

Fork of ScoreCount by George Cochrane

reciever.cpp

Committer:
gcme93
Date:
2013-05-02
Revision:
5:a50e02fc49cd
Parent:
4:7cec137649a0
Child:
6:e269f6c282bc

File content as of revision 5:a50e02fc49cd:

#include "mbed.h"

char string[64];
int p;


int Interrogate()
{
Serial myserial(PTC4,PTC3);
myserial.baud(1200);
DigitalOut blueled(LED1);

    while(1) 
         {
           while(!myserial.readable())
                {
                  blueled=1;
                }
           
           if(myserial.readable())
             {
             blueled=0;
            myserial.scanf("%s",string);
                  
             if((strstr (string,"011")) != NULL)
               {
                 p = 1;
               }
             if((strstr (string,"012")) != NULL)
               {
                 p = 2;
               }
             if((strstr (string,"013")) != NULL)
               {
                 p = 3;
               }
             if((strstr (string,"014")) != NULL)
               {
                 p = 4;
               }
             for(int f=0;f<5;f++)
             {
             blueled=!blueled;
             wait(0.2);             
             return p;  
             }                       
             }           
         }
}