![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
First step: AutoIP compiled in and working
main.cpp@0:55a05330f8cc, 2010-06-18 (annotated)
- Committer:
- darran
- Date:
- Fri Jun 18 09:11:35 2010 +0000
- Revision:
- 0:55a05330f8cc
- Child:
- 1:4218cacaf696
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
darran | 0:55a05330f8cc | 1 | #include "mbed.h" |
darran | 0:55a05330f8cc | 2 | #include "EthernetNetIf.h" |
darran | 0:55a05330f8cc | 3 | |
darran | 0:55a05330f8cc | 4 | DigitalOut myled(LED1); |
darran | 0:55a05330f8cc | 5 | |
darran | 0:55a05330f8cc | 6 | EthernetNetIf eth; |
darran | 0:55a05330f8cc | 7 | |
darran | 0:55a05330f8cc | 8 | int main() { |
darran | 0:55a05330f8cc | 9 | EthernetErr ethErr = eth.setup(); |
darran | 0:55a05330f8cc | 10 | if (ethErr) { |
darran | 0:55a05330f8cc | 11 | printf("Error %d in setup on DHCP.\r\n", ethErr); |
darran | 0:55a05330f8cc | 12 | return -1; |
darran | 0:55a05330f8cc | 13 | } |
darran | 0:55a05330f8cc | 14 | printf("Trying to get IP address\r\n"); |
darran | 0:55a05330f8cc | 15 | IpAddr ip = eth.getIp(); |
darran | 0:55a05330f8cc | 16 | printf("mbed IP Address is %d.%d.%d.%d\r\n", ip[0], ip[1], ip[2], ip[3]); |
darran | 0:55a05330f8cc | 17 | |
darran | 0:55a05330f8cc | 18 | printf("Entering while loop Net::poll()ing\r\n"); |
darran | 0:55a05330f8cc | 19 | while (1) { |
darran | 0:55a05330f8cc | 20 | Net::poll(); |
darran | 0:55a05330f8cc | 21 | myled = 1; |
darran | 0:55a05330f8cc | 22 | wait(0.2); |
darran | 0:55a05330f8cc | 23 | myled = 0; |
darran | 0:55a05330f8cc | 24 | wait(0.2); |
darran | 0:55a05330f8cc | 25 | } |
darran | 0:55a05330f8cc | 26 | } |