Ergänzt das jQueryMobile Beispiel um die Fehlenden Aktoren wie LED 3 und Servo 2.

Fork of RPCHTTPServerVariable by smd.iotkit2.ch

Revision:
11:4f5efa32051c
Parent:
10:f92d1e679fea
Child:
12:fc0fe305d4d3
--- a/main.cpp	Wed Mar 11 18:52:34 2015 +0000
+++ b/main.cpp	Wed Mar 11 19:11:18 2015 +0000
@@ -5,15 +5,31 @@
 #include "EthernetInterface.h"
 #include "HTTPServer.h"
 #include "mbed_rpc.h"
+#include "Servo.h"
 
 EthernetInterface eth;
 
+// Servo + aktuelle Werte
+Servo servo1 ( A4 );
+Servo servo2 ( A5 );
+float val1, val2;
+Ticker servos;
+
+// Update Servo Werte
+void updateServo()
+{
+    servo1 = val1;
+    servo2 = val2;
+}
+
 int main()
 {
     printf("RPC HTTP Server\n");
     eth.init(); //Use DHCP
     eth.connect();
     printf("IP Address is %s\n\r", eth.getIPAddress());
+    
+    servos.attach( &updateServo, 1.0 );
         
     // Klassen
     RPC::add_rpc_class<RpcDigitalOut>();
@@ -27,6 +43,8 @@
     RPC::construct<RpcPwmOut, PinName, const char*>(D12, "led3");
     RPC::construct<RpcDigitalIn, PinName, const char*>(PTC9, "b1");
     //RPC::construct<RpcAnalogIn, PinName, const char*>(A0, "light");
+    RPCVariable<float> rpcVal1( &val1, "servo1" );
+    RPCVariable<float> rpcVal2( &val2, "servo2" );
 
     // Handler
     HTTPServerAddHandler<RPCHandler>("/rpc");