I'm building a sous-vide shield, and I would like to support both ethernet and serial. However I need to use 9 digital outputs, so I must choose either ethernet, or serial, but cannot support both simultaneously.
I'd like to add a multiplexor, such that if I detect an ethernet shield, I use pins 0 and 1 as digital outputs. If I don't detect a ethernet shield, I use pins 4 and 10 instead. I know I could do this with board jumpers, but why not just autodetect the shield.
Any ideas on how to autodetect an ethernet shield to control my mux?
fungus:
I don't think the Ethernet library supports DCHP...
I don't know how recent it is, but v1.0 now supports DHCP, and it works very well for me:
Returns
The DHCP version of this function, Ethernet.begin(mac), returns an int: 1 on a successful DHCP connection, 0 on failure. The other versions don't return anything.
Apparently it retries for 2 minutes before giving up...
SurferTim:
If you are going to all that trouble, then assign a static ip and read it.
I could, but then if I plug multiple sous-vide cookers into my network, I'd have to customize the code for each arduino., and then I could collide with an IP that was already assigned by DHCP, etc, etc
Some background. I'm making an internet-of-things-sous-vide cooker. I have the arduino with a ethernet shield controlling a crock pot with the PID library generating PWM to control a solid-state relay. The arduino is running a mqtt client, communicating to an mqtt broker running on a raspberry pi. I have commands, status, and temperature data on separate channels, so I can remote control and query my arduino. I also have a node.js data logger, sending temperature logs to a file every 10s, so I can plot my PID controller performance.
I may try to do away with the rasperry pi, and write a web server on the arduino that tracks temperature logs. I could use the google charts api, to do all the graphics on the client side.
I want these things to be smart enough, so that I can fab a bunch of pcb for friends and family, they can plug them in and happily start cooking without requiring everybody to upload custom arduino code that is compatible with their network. For now I just gave up and added a jumper that will select ethernet or not.