On the Arduino Ethernet Shield v2 the SD card and Ethernet are connected via SPI. I want to use both, the SD card and Ethernet over the life time of the overall application. How do I have to do the setup then? Can I use
Ethernet.begin(mac, ip); once at startup and dynamically switch between them with the SPI chip selects (Pin 4 for SD card, Pin 10 for ETH)? Ethernet will be needed most of the time. So I'd chip select Pin 4 (low -> active:
digitalWrite(sdChipSelectPin, LOW); digitalWrite(ethernetChipSelectPin, HIGH);) only for the time of reading from/writing to the SD card and chip select Pin 10 (vice versa to enable Ethernet) else, right?
EDIT: On top of the Ethernet lib I'm using aWOT for providing RESTful API endpoints. To send data I'm using the mWebSockets lib. Of course everything should work despite of writing data to the SD card as part of a RESTful API endpoint logic