![](/media/cache/group/ep_srxDLMd.webp.50x50_q85.jpg)
HTTP RPC Server mit vordefinierten Objekten
Dependencies: EthernetInterface HttpServer Servo mbed-rtos mbed
Fork of RPCHTTPServerVariable by
Mittels RPCVariable lassen sich lokale Variablen setzen. Diese Variablen können gesetzt write oder gelesen read werden.
Mittels Ticker u.ä. Varianten lassen sich damit auch Objektwerte setzen, welche von RPC nicht unterstützt werden, z.B. Servo's.
Client
Wert setzen: http://<IP-Adresse mbed>/rpc/servo2/write+0.5
Diff: main.cpp
- Revision:
- 5:bfa9878aa274
- Parent:
- 4:155c6ff99458
- Child:
- 6:c9c7ffa0594e
diff -r 155c6ff99458 -r bfa9878aa274 main.cpp --- a/main.cpp Fri Feb 21 07:42:20 2014 +0000 +++ b/main.cpp Sat Feb 22 05:55:58 2014 +0000 @@ -5,16 +5,18 @@ #include "HTTPServer.h" #include "mbed_rpc.h" #include "TextLCD.h" + EthernetInterface eth; DigitalOut led4(LED4); - -LocalFileSystem local("local"); - void LcdWrite(Arguments* arg, Reply* r); //ADD Here!! - + +LocalFileSystem local("local"); +void LcdWrite(Arguments* arg, Reply* r); //ADD Here!! + TextLCD lcd(p24, p26, p27, p28, p29, p30); -void aliveState(void const *args) { +void aliveState(void const *args) +{ while (true) { led4 = !led4; Thread::wait(1000); @@ -26,16 +28,16 @@ printf("********* PROGRAM START ***********\r\n"); Thread thread(aliveState); RPC::add_rpc_class<RpcDigitalOut>(); - RPC::construct<RpcDigitalOut, PinName, const char*>(LED1, "led1"); - RPC::construct<RpcDigitalOut, PinName, const char*>(LED2, "led2"); - RPC::construct<RpcDigitalOut, PinName, const char*>(LED3, "led3"); + RPC::construct<RpcDigitalOut, PinName, const char*>(LED1, "led1"); + RPC::construct<RpcDigitalOut, PinName, const char*>(LED2, "led2"); + RPC::construct<RpcDigitalOut, PinName, const char*>(LED3, "led3"); RPCFunction rpcFunc(LcdWrite, "LcdWrite"); //ADD Here!! - lcd.cls(); + lcd.cls(); lcd.locate(0,0); printf("EthernetInterface Setting up...\r\n"); if(eth.init()!=0) { //for DHCP Server - //if(eth.init(IPAddress,NetMasks,Gateway)!=0) { //for Static IP Address + //if(eth.init(IPAddress,NetMasks,Gateway)!=0) { //for Static IP Address printf("EthernetInterface Initialize Error \r\n"); return -1; }