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: C12832_lcd EthernetInterface HttpServer mbed-rpc mbed-rtos mbed
Fork of HttpServerSample by
Diff: main.cpp
- Revision:
- 3:5758cfefe980
- Parent:
- 0:050a5d4ffd55
- Child:
- 4:155c6ff99458
--- a/main.cpp Thu Feb 20 06:18:18 2014 +0000
+++ b/main.cpp Thu Feb 20 13:12:46 2014 +0000
@@ -4,13 +4,17 @@
#include "rtos.h"
#include "EthernetInterface.h"
#include "HTTPServer.h"
+#include "mbed_rpc.h"
EthernetInterface eth;
-DigitalOut led1(LED1);
+
+DigitalOut led4(LED4);
+
+LocalFileSystem local("local");
void aliveState(void const *args) {
while (true) {
- led1 = !led1;
+ led4 = !led4;
Thread::wait(1000);
}
}
@@ -19,6 +23,11 @@
{
printf("********* PROGRAM START ***********\r\n");
Thread thread(aliveState);
+ RPC::add_rpc_class<RpcDigitalOut>();
+ RPC::construct<RpcDigitalOut, PinName, const char*>(LED1, "led1"); // mbed LED
+ RPC::construct<RpcDigitalOut, PinName, const char*>(LED2, "led2");
+ RPC::construct<RpcDigitalOut, PinName, const char*>(LED3, "led3");
+
printf("EthernetInterface Setting up...\r\n");
if(eth.init()!=0) { //for DHCP Server
//if(eth.init(IPAddress,NetMasks,Gateway)!=0) { //for Static IP Address
@@ -34,7 +43,11 @@
printf("Gateway Address is %s\r\n", eth.getGateway());
printf("Ethernet Setup OK\r\n");
- HTTPServerAddHandler<SimpleHandler>("/"); //Default handler
+ HTTPServerAddHandler<SimpleHandler>("/hello"); //Default handler
+ FSHandler::mount("/local", "/");
+ HTTPServerAddHandler<FSHandler>("/");
+ HTTPServerAddHandler<RPCHandler>("/rpc");
+
HTTPServerStart(80);
}
