First commit
Dependencies: EthernetInterface FXAS21002 FXOS8700 NetworkAPI mbed-rtos mbed
main.cpp@6:33b57f606f2b, 2012-07-17 (annotated)
- Committer:
- NegativeBlack
- Date:
- Tue Jul 17 15:21:06 2012 +0000
- Revision:
- 6:33b57f606f2b
- Parent:
- 5:01f6c3e112af
- Child:
- 8:d55cac25e637
Simple hello world example doing a hostname lookup.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donatien | 0:bb128f0e952f | 1 | #include "mbed.h" |
donatien | 0:bb128f0e952f | 2 | #include "EthernetInterface.h" |
donatien | 0:bb128f0e952f | 3 | |
NegativeBlack | 6:33b57f606f2b | 4 | #include "NetworkAPI/ip/address.hpp" |
donatien | 0:bb128f0e952f | 5 | |
NegativeBlack | 6:33b57f606f2b | 6 | int |
NegativeBlack | 6:33b57f606f2b | 7 | main() |
NegativeBlack | 6:33b57f606f2b | 8 | { |
NegativeBlack | 6:33b57f606f2b | 9 | EthernetInterface interface; |
NegativeBlack | 6:33b57f606f2b | 10 | interface.init(); |
NegativeBlack | 6:33b57f606f2b | 11 | interface.connect(); |
NegativeBlack | 6:33b57f606f2b | 12 | printf("IP Address is %s\n\r", interface.getIPAddress()); |
NegativeBlack | 6:33b57f606f2b | 13 | |
NegativeBlack | 6:33b57f606f2b | 14 | network::ip::Address address; |
NegativeBlack | 6:33b57f606f2b | 15 | address.fromHostname("www.google.nl"); |
donatien | 0:bb128f0e952f | 16 | |
NegativeBlack | 6:33b57f606f2b | 17 | printf("Network address %s\n", address.toString().c_str()); |
NegativeBlack | 6:33b57f606f2b | 18 | return 0; |
NegativeBlack | 6:33b57f606f2b | 19 | } |