Labs/Lab6/Watkins_William_Lab6_Part2.c
// <editor-fold defaultstate="collapsed" desc="readCommand()">
/******************************************************************************
 * readCommand() subroutine
 *
 * Reads buffer after \n detected over EUSART
 ******************************************************************************/

readCommand() subroutine

Reads buffer after \n detected over EUSART
readCommand () subroutine Reads buffer after \ n detected over EUSART
void readCommand() {
    switch(i)
    {
        case 3:
            if(strcmp(buffer, checkPOT) == 0)
                sendPOT = 1;
            break;
        case 4:
            if(strcmp(buffer, checkTEMP) == 0)
                sendTEMP = 1;
            break;
        case 7:
            if(strcmp(buffer, checkCONTON) == 0)
                sendCONT = 1;
            break;
        case 8:
            if(strcmp(buffer, checkCONTOFF) == 0)
                sendCONT = 0;
            break;
        default:
            sendERROR = 1;
    }
    i = 0;
    rxFin = 0;
}
void readCommand ( ) { switch ( i ) { case 3 : if ( strcmp ( buffer , checkPOT ) == 0 ) sendPOT = 1 ; break ; case 4 : if ( strcmp ( buffer , checkTEMP ) == 0 ) sendTEMP = 1 ; break ; case 7 : if ( strcmp ( buffer , checkCONTON ) == 0 ) sendCONT = 1 ; break ; case 8 : if ( strcmp ( buffer , checkCONTOFF ) == 0 ) sendCONT = 0 ; break ; default : sendERROR = 1 ; } i = 0 ; rxFin = 0 ; }
<editor-fold defaultstate="collapsed" desc="readCommand()">
 readCommand() subroutine
<editor - fold defaultstate = " collapsed " desc = " readCommand () " > readCommand () subroutine
// Check if buffer has a correct length command & is the correct command and deal accordingly