ENC28J60 and UIPEthernet.h

Hi

I have an adruino nano and enc28j60. I would like to be able to turn off and on the port so that the lights on the switch would also turn off and on. The purpose is to make the network port blink. I am trying to make my own tool that will help me identify where a wall port is plugged in the switch.

In the UIPEthernet.h library in the utility folder there is a file Enc28J60Network.h that has two functions: powerOn and powerOff. I assume these can do what I am trying to do, but I can’t figure out how to use them.

This is what I tried. The code compiles, but neither the switch port turns off, nor the device itself go offline because I can constantly ping it.

#include <UIPEthernet.h>

Enc28J60Network enc;
EthernetServer server = EthernetServer(1000);

void setup()
{
  Serial.begin(9600);

  uint8_t mac[6] = {0x00,0x01,0x02,0x03,0x04,0x05};
  IPAddress myIP(192,168,1,6);

  Ethernet.begin(mac,myIP);

}

void loop()
{
  size_t size;

  enc.powerOn();
  delay(3000);                       
  enc.powerOff();
}
void loop()
{
  size_t size;

  enc.powerOn();
  delay(3000);                       
  enc.powerOff();
}

Your code does:

  • call powerOn()
  • wait 3 secs.
  • call powerOff()
  • call powerOn()
  • wait 3 secs.
  • call powerOff()

I hope you can see that even if the hardware really is switched off by this call, you won't realize it.

Thanks. That did it. delay(3000) after the powerOff()