A simple HTTP server echoing received requests. Ethernet connection is over an ENC28J60 board. Usage: Type the server's IP address into you web browser and hit <ENTER>.
Revision 3:f3bfd257e138, committed 2015-11-27
- Comitter:
- hudakz
- Date:
- Fri Nov 27 20:48:39 2015 +0000
- Parent:
- 2:519b6ae198ae
- Child:
- 4:06fcbe983e24
- Commit message:
- Updated.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Nov 27 20:35:35 2015 +0000 +++ b/main.cpp Fri Nov 27 20:48:39 2015 +0000 @@ -1,6 +1,6 @@ /* * In this example the HTTP request (text) received from a browser is echoed (sent back) to the browser. - * Ethernet connection is via an ENC28J60 board driven by UIPEthernet + * Ethernet connection is via an ENC28J60 Ethernet board driven by the UIPEthernet library */ #include "mbed.h" #include <UIPEthernet.h> @@ -30,8 +30,8 @@ #elif defined(TARGET_NUCLEO_F411RE) UIPEthernetClass UIPEthernet(D11, D12, D13, D10); // mosi, miso, sck, cs #endif + // MAC number must be unique within the connected network. Modify as appropriate. - const uint8_t MY_MAC[6] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 }; #if !defined(DHCP) @@ -51,10 +51,11 @@ */ int main(void) { + +#if defined(DHCP) pc.printf("Searching for DHCP server.\r\n"); pc.printf("It takes some time. Please wait..\r\n"); -#if defined(DHCP) if(UIPEthernet.begin(MY_MAC) != 1) { pc.printf("No DHCP server found.\r\n"); pc.printf("Exiting application\r\n");