Ethernet
Hardware¶
First of all you have to connect your mbed to a RJ45 jack. These instructions can be found here : Ethernet RJ45.
Software¶
See: Ethernet Interface library.
Legacy Networking Libraries
Getting started¶
This is essentially a tri-liner:
First include the header file:
#include "EthernetNetIf.h"
Instantiate the interface: If you are using DHCP:
EthernetNetIf eth;
Or if you want to set your own parameters:
EthernetNetIf eth( IpAddr(192,168,0,101), //IP Address IpAddr(255,255,255,0), //Network Mask IpAddr(192,168,0,1), //Gateway IpAddr(192,168,0,1) //DNS );
And set it up:
eth.setup();
That's it!
Includes¶
#include "EthernetNetIf.h"
Reference¶
Import program
Public Member Functions |
|
EthernetNetIf () | |
Instantiates the Interface and register it against the stack, DHCP will be used.
|
|
EthernetNetIf ( IpAddr ip, IpAddr netmask, IpAddr gateway, IpAddr dns) | |
Instantiates the Interface and register it against the stack, DHCP will not be used.
|
|
EthernetErr | setup (int timeout_ms=15000) |
Brings the interface up.
|
|
IpAddr | getIp () const |
Returns the IP of the interface once it's connected.
|