Hello I currently Have 4 Arduino Boards with EthernetShields on them:
Arduino Mega with HR911105A 15/10
Arduino Uno with HR911105A 15/10
Arduino Nano with HR911105A 15/12 ENC28J60 (NANO
Arduino Nano with HR911105A 15/12 ENC28J60 (NANO V1.0) DeeRobot
First of all if there is any Library that will handle them all? Ethernet.h Doesn't work with NANO ones and I have to use EtherCard for them. Sadly EtherCard can't work with Mega and Uno for some reason.
My project is to communicate those 4 boards with themselves via 1 "motherboard" that i will use to menage others.
I want to have unos and nanos gathering data and after it triggers some build in flags send them to mega, mega will send them back info about getting data also i want sometimes to change some variables in those 3 arduinos just by sending them instructions so i guess I have to set all boards to servers, am i right?
Tell me also if there is some build in "BUSY" function if for example the mega will recive data from 2 arduinos at once!?
Hanrun is just the manufacturer of the RJ45 jack you plug the Ethernet cable into. The numbers on that part are irrelevant. What's important is the type of Ethernet controller chip on the shield. You need to use the correct library for the Ethernet controller chip or it won't work. This will be a black square/rectangular chip. There is small writing on the top. You already know the Ethernet controller chip on the second two is ENC28J60 and the EtherCard is written specifically for that chip. The other common chips are the WIZnet W5100, W5200, and W5500. The EtherCard library will not work with those chips. The latest version of the official Arduino Ethernet library does support all the WIZnet chips (but not the ENC28J60). You can make sure you have version 2.0.0 of the Ethernet library installed by doing this:
- Sketch > Include Library > Manage Libraries
- Wait for the download to finish
- In the "Filter your search..." box, type "ethernet"
- From the search results, click on "Ethernet by Various".
- If it says "Version 2.0.0 INSTALLED", then you're already set. Otherwise, click "Update" and wait for the update to finish.
- Click "Close".
You can find examples for the Ethernet library under File > Examples > Ethernet. The associated tutorials are here: https://www.arduino.cc/en/Tutorial/LibraryExamples#ethernet. The (somewhat outdated) reference is here: Ethernet - Arduino Reference.
Since the EtherCard and Ethernet libraries have different APIs, it can be difficult to write a single code that works for all your shields. You might consider using the UIPEthernet library for the ENC28J60. That library is written with a very similar API to the Ethernet library. Ethernet does have some new functions that are not in UIPEthernet, but nothing critical. Then you can simply have in your code something like this:
#include <Ethernet.h> // Uncomment this line for WIZnet Ethernet shield
// #include <UIPEthernet.h> // Uncomment this line for ENC28J60 Ethernet shield