I have Arduino Nano "clone" which I would like to use with Ethernet ENC28J60 shield. I have noticed that when I include/use UIPEthernet.h
library, build-in LED does not work properly. I have written the following sketch which I have uploaded to Arduino and run both with and without Ethernet shield with the same result: LED is not blinking. Once I comment out the line Ethernet.begin(mac)
, LED starts blinking just fine.
Is there any way to overcome this conflict?
#include <UIPEthernet.h>
EthernetClient ethClient;
uint8_t mac[6] = { 0x90, 0xA2, 0xDA, 0x0D, 0xE2, 0xCD };
void setup() {
Serial.begin(115200);
// If this line is commented, LED starts blinking:
Ethernet.begin(mac);
pinMode(LED_BUILTIN, OUTPUT);
Serial.println(F("setup() done."));
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
1 Answer 1
No, you can't.
The LED is on pin 13. Pin 13 is the clock pin for SPI. The ENC28J60 is an SPI device.
You either have control over pin 13, or you have SPI. You can't have both.
-
Thanks for this information! Good to know that. Probably there is some way to "stop" Ethernet and start using LED? Unfortunately, I found no
Ethernet.stop()
or similar.dma_k– dma_k2019年08月11日 23:36:59 +00:00Commented Aug 11, 2019 at 23:36