I am relatively new to arduino and am attempting to add a w5100 shield and code to someone elses project.
I have searched the forums but can't find a direct answer to my question.
The query I have is about what PIN10 is used for on the ethernet shield and in the library. The project I am working with uses all of the Mega2560 PWM channels for LED control (via PWM) including PIN10.
Before I lash out on hardware I want to confirm based on my reading that my understanding is correct, that I could (if I didn't stack it on the 2560) connect pin 10 to any other Digital I/O pin and modify the library, and that it doesn't actually need a PWM signal.
I will do the data via the ICSP header so that is covered.
Do it! Digital pin 10 does not have anything to do with the SPI on a Mega, just the Slave Select for the ethernet shield.
How many PWM outputs do you need? The Mega has a bunch. From the products page:
PWM: 2 to 13 and 44 to 46. Provide 8-bit PWM output with the analogWrite() function.
Pins 11-13 have nothing to do with the SPI on a Mega, so you can use those also.
The PWM outputs are being used for an aquarium controller which times the PWM LED drivers for the lighting.
The problem I have is that I have an ITDBO2 shield in the mix which uses:
ITDB02_Touch myTouch (6,5,4,3,2);
There are a lot of other I/Os in use which I am more than happy to futz with the allocations of, but when it comes to Henning Karlsens libraries I don’t want to mess with the voodoo as it’s above my understanding and this shield really needs to be left stock due to the screen and header.
The standard code I am building from already uses the following pins for their PWM ability and breaking the “conflicted” PIN 10 out on 44-46 I could do, it will make things a little messy on the protoshield I am using, due to the volumes of I/Os on that part of the board I am already using:
const int ledPinSump = 7;
const int ledPinBlue = 8; /
const int ledPinWhite = 9;
const int ledPinRoyBlue = 10; // <--- Needed by ethernet shield (if using std library)
const int ledPinRed = 11;
const int ledPinUV = 12;
const int ledPinMoon = 13;
If it is as simple as allocating as per below then problem solved, if not as nice hardware wise.
const int ledPinRoyBlue = 44;