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

main.cpp

Committer:
stefan1691
Date:
2015-03-11
Revision:
9:66ff9ae5572e
Parent:
8:3e6bfb96a451
Child:
10:f92d1e679fea

File content as of revision 9:66ff9ae5572e:

/** Minimalistischer RCP HTTP Server
*/
#include "mbed.h"
#include "rtos.h"
#include "EthernetInterface.h"
#include "HTTPServer.h"
#include "mbed_rpc.h"

EthernetInterface eth;

int main()
{
    printf("RPC HTTP Server\n");
    eth.init(); //Use DHCP
    eth.connect();
    printf("IP Address is %s\n\r", eth.getIPAddress());
        
    // Klassen
    RPC::add_rpc_class<RpcDigitalOut>();
    
    // Objekte
    RPC::construct<RpcDigitalOut, PinName, const char*>(D10, "led1");
    RPC::construct<RpcDigitalOut, PinName, const char*>(D11, "led2");
    RPC::construct<RpcDigitalOut, PinName, const char*>(D12, "led3");
    RPC::construct<RpcDigitalOut, PinName, const char*>(D13, "led4");

    // Handler
    HTTPServerAddHandler<RPCHandler>("/rpc");
    
    // Start HTTP Server auf Port 80
    printf( "Starte Server\n" );
    HTTPServerStart(80);
}