Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 4DGL-uLCD-SE RPCInterface mbed
Fork of rpc_mbed by
main.cpp
00001 #include "mbed.h" 00002 #include "mbed_rpc.h" 00003 #include "uLCD_4DGL.h" 00004 #include <ctype.h> 00005 #include "RGB_LED.h" 00006 00007 //Use the RPC enabled wrapped class - see RpcClasses.h for more info 00008 Serial pc(USBTX, USBRX); 00009 PinName tx, rx, rst; 00010 RGBLed myRGBled(p22,p23,p24); 00011 uLCD_4DGL uLCD(p28, p27, p29); 00012 char text; 00013 //string screen; 00014 00015 void clearLCD(Arguments *in, Reply *out); 00016 RPCFunction rpcClear(&clearLCD, "clearLCD"); 00017 00018 void printLCDAndLightRGB(Arguments *in, Reply *out); 00019 RPCFunction rpcPrintLCDAndLightRGB(&printLCDAndLightRGB, "printLCDAndLightRGB"); 00020 00021 int main() { 00022 00023 char buf[256], outbuf[256]; 00024 while(1) { 00025 pc.gets(buf, 256); 00026 //Call the static call method on the RPC class 00027 RPC::call(buf, outbuf); 00028 pc.printf("%s\n", outbuf); 00029 } 00030 } 00031 00032 void clearLCD(Arguments *in, Reply *out) 00033 { 00034 uLCD.cls(); 00035 } 00036 00037 void printLCDAndLightRGB(Arguments *in, Reply *out) 00038 { 00039 uLCD.cls(); 00040 char * text = in->getArg<char *>(); 00041 int value = strlen(text); 00042 if(text[0] == '1'){ 00043 myRGBled.write(0,1.0f,0); 00044 uLCD.printf("Tweet is found!\n"); 00045 uLCD.printf("\n"); 00046 } else if(text[0] == '0'){ 00047 myRGBled.write(0,0,1.0f); 00048 } 00049 text[0] = '-'; 00050 for(int i = 0; i< value; i++) { 00051 if(text[i] == '|') { 00052 text[i] = ' '; 00053 } 00054 } 00055 uLCD.printf(text); 00056 }
Generated on Thu Aug 4 2022 07:14:09 by
1.7.2
