Demo usage of LLAP library

Dependencies:   LLAPSerial mbed

main.cpp

Committer:
SomeRandomBloke
Date:
2014-04-15
Revision:
0:95297d07b5c6
Child:
1:808e9257d1ea

File content as of revision 0:95297d07b5c6:

// Demo Ciseco LLAPSerial usage
#include "mbed.h"
#include "LLAPSerial.h"

//LLAPSerial srf(PA_11, PA_12);
// or
LLAPSerial srf(PA_11, PA_12, "MB");

Serial pc(USBTX, USBRX);

DigitalOut srfEnable(PA_9);

int main()
{
    pc.baud(115200);
    pc.printf("LLAP Test\n");

    srfEnable = 1;
    srf.sendMessage("STARTED");
    wait_ms(100);
    srf.sendMessage("TMPA", "123");
    wait_ms(100);
    srf.sendInt("TMPA", 123);
    wait_ms(100);
    srf.sendIntWithDP("TMPA", 1230,2);
    while( 1 ) {
        if( srf.bMsgReceived ) {
            myled = !myled;
            pc.printf("Received: %s\n\r",srf.sMessage );
            srf.bMsgReceived = false;   // Clear flag to indicate msg handled
        }
    }

}