Nydrel Jack / Mbed 2 deprecated rpc_mbed

Dependencies:   4DGL-uLCD-SE RPCInterface mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "mbed_rpc.h"
00003 #include "uLCD_4DGL.h"
00004 #include <ctype.h>
00005 
00006 /**
00007  *  This example program has been updated to use the RPC implementation in the new mbed libraries.
00008  *  This example shows the uses of the RPCDigitalOut wrapper class
00009  */
00010  
00011 //Use the RPC enabled wrapped class  - see RpcClasses.h for more info
00012 Serial pc(USBTX, USBRX);
00013 PinName tx, rx, rst;
00014 uLCD_4DGL uLCD(p28, p27, p29);
00015 char text;
00016 //string screen;
00017  
00018 void clearLCD(Arguments *in, Reply *out);
00019 RPCFunction rpcClear(&clearLCD, "clearLCD");
00020 
00021 void printLCD(Arguments *in, Reply *out);
00022 RPCFunction rpcPrint(&printLCD, "printLCD");
00023   
00024 int main() {
00025  
00026     char buf[256], outbuf[256];
00027     while(1) {
00028         pc.gets(buf, 256);
00029         //Call the static call method on the RPC class
00030         RPC::call(buf, outbuf); 
00031         pc.printf("%s\n", outbuf);
00032     }
00033 }
00034 
00035 void clearLCD(Arguments *in, Reply *out)
00036 {
00037     uLCD.cls();
00038     //out->putData("Successfully created uLCD object!");
00039 }
00040 
00041 void printLCD(Arguments *in, Reply *out)
00042 {
00043         char * text = in->getArg<char *>();
00044         uLCD.puts(text);
00045         uLCD.puts("\n");
00046  }