Hi Stephen,
I used Ilya l's HTTP web server successfully - once compiled and loaded, the mbed is constantly listening and responds to ping requests. You can easily modify it to get what you want it to do, either to return a static page, respond to rpc commands etc. It can be found here and the file to modify is main.cpp about line 149. By default it uses DHCP but I modified mine to use a static IP which is read from a local file on the mbed. It means you don't have to compile again if you want to change the static IP addrress.
When HTTPServer http(hostname) is called, if the only argument passed is the hostname then DHCP is used. Otherwise use something along the lines of:
char *hostname = "mbed";
cip = IPv4(192,168,0,123);
cdns = IPv4(192,168,0,1);
cgw = IPv4(192,168,0,1);
csm = IPv4(255,255,255,0);
HTTPServer http(hostname,cip,csm,cgw,cdns);
There used to be a bug in it whereby it hung if no ethernet connection was found when the mbed was restarted. Just make sure that a cat5e cable is plugged into your mbed from your router before restarting and testing it.
Mike
Hi
I am trying to get started with Ethernet. I followed the instruction for connecting the four wires to magnetics etc on proto boards and got nowhere. Then assuming that I had screwed up the connections , I bought a coolcomponenets board with RJ45 etc and still cannot get going. My setup is local network with internet gateway PC running XP and I have fixed IP so code i have used is as per examples ( Donatiens et al ) but with change to remove DHCP
EthernetNetIf eth(
IpAddr(192,168,0,123), //IP Address
IpAddr(255,255,255,0), //Network Mask
IpAddr(192,168,0,1), //Gateway
IpAddr(192,168,0,1) //DNS
);
The output I get on serial port
Setting up...
[..\fwk\if\eth\EthernetNetIf.cpp:setup@86] HW Addr is : 00:02:f7:f0:24:65.
[..\fwk\if\eth\EthernetNetIf.cpp:setup@142] Connected, IP : 192.168.0.123
Setup OK
Error 3
Can anyone help ? What is error 3 ?
I am struggling as this is both new hardware to me and also I am having to learn c++ ( i have java background) so I am not sure what is going wrong. I have got the MBED to interface to compasses and accelerometers etc but this lack of Ethernet is holding me up.
Many thanks
Regards
Steve