microrobotics

ENC28J60 Nano Shield

Jul 14th, 2017
4,200
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // A simple web server that always just says "Hello World"
  2.  
  3. #include "etherShield.h"
  4. #include "ETHER_28J60.h"
  5.  
  6. // Define MAC address and IP address - both should be unique in your network
  7. static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24};  
  8. static uint8_t ip[4] = {192, 168, 1, 15};
  9. static uint16_t port = 80; // Use port 80 - the standard for HTTP                                    
  10.  
  11. ETHER_28J60 ethernet;
  12.  
  13. void setup()
  14. {
  15.   ethernet.setup(mac, ip, port);
  16. }
  17.  
  18. void loop()
  19. {
  20.   if (ethernet.serviceRequest())
  21.   {
  22.     ethernet.print("<H1>Hello World</H1>");
  23.     ethernet.respond();
  24.   }
  25.   delay(100);
  26. }
RAW Paste Data