Andrew Lindsay
/
Ciseco_LLAP_Test
Demo usage of LLAP library
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 // Demo Ciseco LLAPSerial usage 00002 00003 /** 00004 * The MIT License (MIT) 00005 * 00006 * Copyright (c) 2014 Andrew Lindsay 00007 * 00008 * Permission is hereby granted, free of charge, to any person obtaining a copy 00009 * of this software and associated documentation files (the "Software"), to deal 00010 * in the Software without restriction, including without limitation the rights 00011 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00012 * copies of the Software, and to permit persons to whom the Software is 00013 * furnished to do so, subject to the following conditions: 00014 * 00015 * The above copyright notice and this permission notice shall be included in 00016 * all copies or substantial portions of the Software. 00017 * 00018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00019 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00020 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00021 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00022 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00023 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00024 * THE SOFTWARE. 00025 */ 00026 00027 #include "mbed.h" 00028 #include "LLAPSerial.h" 00029 00030 //LLAPSerial srf(PA_11, PA_12, PA_9); 00031 // or 00032 //LLAPSerial srf(PA_11, PA_12, PA_9, false,"MB"); 00033 LLAPSerial srf(PA_2, PA_3, PA_9, false,"MB"); 00034 00035 //Serial pc(USBTX, USBRX); 00036 Serial pc(PA_11, PA_12); 00037 00038 int main() 00039 { 00040 pc.baud(115200); 00041 pc.printf("LLAP Test\n"); 00042 00043 srf.sendMessage("STARTED"); 00044 wait_ms(100); 00045 srf.sendMessage("TMPA", "123"); 00046 wait_ms(100); 00047 srf.sendInt("TMPA", 123); 00048 wait_ms(100); 00049 srf.sendIntWithDP("TMPA", 1230,2); 00050 while( 1 ) { 00051 if( srf.bMsgReceived ) { 00052 //myled = !myled; 00053 pc.printf("Received: %s\n\r",srf.sMessage ); 00054 srf.bMsgReceived = false; // Clear flag to indicate msg handled 00055 } 00056 } 00057 00058 }
Generated on Sat Jul 16 2022 08:08:37 by 1.7.2