Example program for the Ciseco SRF Shield, based on UART serial port connectivity (D0/D1 pins). This program sends SRF messages and prints out the received ones
Dependencies: LLAPSerial mbed
Fork of Ciseco_LLAP_Test by
Diff: main.cpp
- Revision:
- 0:95297d07b5c6
- Child:
- 1:808e9257d1ea
diff -r 000000000000 -r 95297d07b5c6 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Apr 15 22:14:11 2014 +0000 @@ -0,0 +1,34 @@ +// 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 + } + } + +}