Hello,
Has anyone encountered an issue where an Ethernet shield does not work when an Arduino UNO R3 is powered by a 9 V adapter?
When the Arduino is connected to a PC via USB, the shield starts up immediately and everything works fine. However, when I disconnect the PC and power the Arduino with a 9 V / 1A adapter (I tried more of them.), the shield does not initialize. Only the PWR LED is on, and nothing else happens.
If I press the reset button on the shield, it starts working right away.
Could this be related to the fact that I am using a static IP address?
I am using VS code + Platformio.
Thank you in advance for any advice.
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(192, 168, 143, 105);
IPAddress gateway(192, 168, 143, 1);
IPAddress subnet(255, 255, 255, 0);
IPAddress dns(192, 168, 143, 1);
void setup() {
delay(1000);
pinMode(4, OUTPUT);
digitalWrite(4, HIGH); // disable sd card
Serial.begin(9600);
Ethernet.begin(mac, ip, dns, gateway, subnet);
Serial.print("IP: ");
Serial.println(Ethernet.localIP());
}
void loop() {
}
Source: r/arduino · by /u/MiraMakovec