Minimalistischer RCP HTTP Server Erweiterte Variante mit RCPVariable und Servo

Dependencies:   EthernetInterface HttpServer Servo mbed-rpc mbed-rtos mbed

Fork of RPCHTTPServerSimple by th.iotkit2.ch

Committer:
stefan1691
Date:
Wed Mar 11 18:52:34 2015 +0000
Revision:
10:f92d1e679fea
Parent:
9:66ff9ae5572e
Child:
11:4f5efa32051c
Erweitert um PwmOut, DigitalIn

Who changed what in which revision?

UserRevisionLine numberNew contents of line
stefan1691 9:66ff9ae5572e 1 /** Minimalistischer RCP HTTP Server
stefan1691 9:66ff9ae5572e 2 */
yueee_yt 0:050a5d4ffd55 3 #include "mbed.h"
yueee_yt 0:050a5d4ffd55 4 #include "rtos.h"
yueee_yt 0:050a5d4ffd55 5 #include "EthernetInterface.h"
yueee_yt 0:050a5d4ffd55 6 #include "HTTPServer.h"
yueee_yt 3:5758cfefe980 7 #include "mbed_rpc.h"
yueee_yt 5:bfa9878aa274 8
yueee_yt 0:050a5d4ffd55 9 EthernetInterface eth;
yueee_yt 3:5758cfefe980 10
yueee_yt 0:050a5d4ffd55 11 int main()
yueee_yt 0:050a5d4ffd55 12 {
stefan1691 9:66ff9ae5572e 13 printf("RPC HTTP Server\n");
stefan1691 9:66ff9ae5572e 14 eth.init(); //Use DHCP
stefan1691 9:66ff9ae5572e 15 eth.connect();
stefan1691 9:66ff9ae5572e 16 printf("IP Address is %s\n\r", eth.getIPAddress());
stefan1691 9:66ff9ae5572e 17
stefan1691 9:66ff9ae5572e 18 // Klassen
yueee_yt 3:5758cfefe980 19 RPC::add_rpc_class<RpcDigitalOut>();
stefan1691 10:f92d1e679fea 20 RPC::add_rpc_class<RpcDigitalIn>();
stefan1691 10:f92d1e679fea 21 //RPC::add_rpc_class<RpcAnalogIn>(); // bringt Link Fehler
stefan1691 10:f92d1e679fea 22 RPC::add_rpc_class<RpcPwmOut>();
marcel1691 7:8a319a112fba 23
stefan1691 9:66ff9ae5572e 24 // Objekte
stefan1691 9:66ff9ae5572e 25 RPC::construct<RpcDigitalOut, PinName, const char*>(D10, "led1");
stefan1691 9:66ff9ae5572e 26 RPC::construct<RpcDigitalOut, PinName, const char*>(D11, "led2");
stefan1691 10:f92d1e679fea 27 RPC::construct<RpcPwmOut, PinName, const char*>(D12, "led3");
stefan1691 10:f92d1e679fea 28 RPC::construct<RpcDigitalIn, PinName, const char*>(PTC9, "b1");
stefan1691 10:f92d1e679fea 29 //RPC::construct<RpcAnalogIn, PinName, const char*>(A0, "light");
yueee_yt 3:5758cfefe980 30
stefan1691 9:66ff9ae5572e 31 // Handler
yueee_yt 3:5758cfefe980 32 HTTPServerAddHandler<RPCHandler>("/rpc");
stefan1691 9:66ff9ae5572e 33
stefan1691 9:66ff9ae5572e 34 // Start HTTP Server auf Port 80
stefan1691 9:66ff9ae5572e 35 printf( "Starte Server\n" );
yueee_yt 0:050a5d4ffd55 36 HTTPServerStart(80);
yueee_yt 0:050a5d4ffd55 37 }
yueee_yt 0:050a5d4ffd55 38