![](/media/cache/group/Download_mxxYCWN.jpg.50x50_q85.jpg)
Minimalistischer RCP HTTP Server Erweiterte Variante mit RCPVariable und Servo
Dependencies: EthernetInterface HttpServer Servo mbed-rpc mbed-rtos mbed
Fork of RPCHTTPServerSimple by
Revision 11:4f5efa32051c, committed 2015-03-11
- Comitter:
- stefan1691
- Date:
- Wed Mar 11 19:11:18 2015 +0000
- Parent:
- 10:f92d1e679fea
- Commit message:
- Erweiterte Variante mit RCPVariable und Servo
Changed in this revision
Servo.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.lib Wed Mar 11 19:11:18 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/simon/code/Servo/#36b69a7ced07
--- 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");