![](/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
Diff: main.cpp
- Revision:
- 0:050a5d4ffd55
- Child:
- 3:5758cfefe980
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Feb 20 05:37:05 2014 +0000 @@ -0,0 +1,40 @@ +//#define DNS_SERVER_ADDRESS(ipaddr) (ip4_addr_set_u32(ipaddr, ipaddr_addr("208.67.222.222"))) /* resolver1.opendns.com */ +#define __DEBUG +#include "mbed.h" +#include "rtos.h" +#include "EthernetInterface.h" +#include "HTTPServer.h" + +EthernetInterface eth; +DigitalOut led1(LED1); + +void aliveState(void const *args) { + while (true) { + led1 = !led1; + Thread::wait(1000); + } +} + +int main() +{ + printf("********* PROGRAM START ***********\r\n"); + Thread thread(aliveState); + printf("EthernetInterface Setting up...\r\n"); + if(eth.init()!=0) { //for DHCP Server + //if(eth.init(IPAddress,NetMasks,Gateway)!=0) { //for Static IP Address + printf("EthernetInterface Initialize Error \r\n"); + return -1; + } + if(eth.connect()!=0) { + printf("EthernetInterface Connect Error \r\n"); + return -1; + } + printf("IP Address is %s\r\n", eth.getIPAddress()); + printf("NetMask is %s\r\n", eth.getNetworkMask()); + printf("Gateway Address is %s\r\n", eth.getGateway()); + printf("Ethernet Setup OK\r\n"); + + HTTPServerAddHandler<SimpleHandler>("/"); //Default handler + HTTPServerStart(80); +} +