Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface HttpServer Motor Servo mbed-rtos mbed StepperMotorUni TMP175
Fork of RPCHTTPServerSimple by
main.cpp
00001 /** Remote Procedure Call (RPC) HTTP Server fuer Eclipse SmartHome (openHAB2) 00002 */ 00003 #include "mbed.h" 00004 #include "rtos.h" 00005 #include "EthernetInterface.h" 00006 #include "HTTPServer.h" 00007 #include "mbed_rpc.h" 00008 #include "RpcClassesExt.h" 00009 00010 EthernetInterface eth; 00011 00012 int main() 00013 { 00014 printf("RPC HTTP Server - SmartHome\n"); 00015 eth.init(); //Use DHCP 00016 eth.connect(); 00017 printf("IP Address is %s\n\r", eth.getIPAddress()); 00018 00019 // Klassen 00020 RPC::add_rpc_class<RpcDigitalOut>(); 00021 RPC::add_rpc_class<RpcDigitalIn>(); 00022 RPC::add_rpc_class<RpcAnalogIn>(); 00023 RPC::add_rpc_class<RpcPwmOut>(); 00024 RPC::add_rpc_class<RpcServo>(); 00025 RPC::add_rpc_class<RpcMotor>(); 00026 RPC::add_rpc_class<RpcStepper>(); 00027 00028 // LED's 00029 RPC::construct<RpcPwmOut, PinName, const char*>(D10, "led1"); 00030 RPC::construct<RpcPwmOut, PinName, const char*>(D11, "led2"); 00031 RPC::construct<RpcPwmOut, PinName, const char*>(D12, "led3"); 00032 RPC::construct<RpcPwmOut, PinName, const char*>(D13, "led4"); 00033 RPC::construct<RpcLEDStrip, PinName, PinName, PinName, const char*>( D5, D6, D7, "ledstrip"); 00034 00035 // Sensoren 00036 RPC::construct<RpcAnalogIn, PinName, const char*>(A0, "poti"); 00037 RPC::construct<RpcAnalogIn, PinName, const char*>(A1, "light"); 00038 RPC::construct<RpcAnalogIn, PinName, const char*>(A2, "hall"); 00039 RPC::construct<RpcTMP75, PinName, PinName, const char*>(D14, D15, "temp"); 00040 00041 // Aktoren 00042 RPC::construct<RpcMotor, PinName, PinName, PinName, const char*>( D3, D2, D4, "motor1" ); 00043 RPC::construct<RpcStepper, const char*>( "stepper1" ); 00044 RPC::construct<RpcServo, PinName, const char*>( D9, "servo1" ); // muss als letzer Eintrag kommen, ansonsten wird Signal gestoert 00045 00046 // Handler 00047 HTTPServerAddHandler<RPCHandler>("/rpc"); 00048 00049 // Start HTTP Server auf Port 80 00050 printf( "Starte Server\n" ); 00051 HTTPServerStart(80); 00052 }
Generated on Wed Jul 13 2022 03:43:27 by
1.7.2
