Good point, I have to update the example too.
I will soon.
The interface changed to be more like the HTTPClient. It will be not needed to call the NetServer object directly. If you not want to change the MAC address or want to give a static IP.
#include "mbed.h"
#include "HTTPServer.h"
#include "HTTPRPC.h"
#include "HTTPFS.h"
using namespace std;
/* Create some objects and make them available in /rpc space */
DigitalOut led1(LED1, "led1");
DigitalOut led2(LED2, "led2");
DigitalOut led3(LED3, "led3");
DigitalOut led4(LED4, "led4");
LocalFileSystem local("local");
int main(void) {
/* Create a HTTPServer on default Port */
HTTPServer *http = new HTTPServer();
/* Register RPC in /rpc space */
http->addHandler(new HTTPRPC());
/* Register local filesystem to all places which are not in /rpc */
http->addHandler(new HTTPFileSystemHandler("/", "/local/"));
printf("Waiting for the Interface comming up...\n");
http->bind();
while(1) {
http->poll();
}
}
To change the IP address or give a hostname to the device do:
#include "util.h"
int main(void) {
NetServer *net = NetServer::create(ipv4addr(192,168,0,2), ipv4addr(255,255,255,0), ipv4addr(192,168,0,1));
net->hostname("joe");
/* Create a HTTPServer on default Port */
HTTPServer *http = new HTTPServer();
Rolf
Hi guys,
I had a 20 character x 4 line display waiting around for a project and it had the same instruction set as the TextLCD example in the WiKi Cookbook, so I wired it up and ran the example program. It worked rather nicely, except it wraps my lines after 16 characters so I need to modify your library code a bit.
Should I start a new Wiki project page for this, or just add to the one that's already there?
Scott