Question about testing shields

I am pretty new to Arduino so I have a lot of gaps in my understanding. I have 2 shields currently on my Mega R3, and I was able to test each individually and have verified functionality. However, when I put them onto the Mega, I am a little lost as to what is needed in code to do more tests.

My shields that I will be using now consist of an Ethernet Shield and a Data Logging/RTC shield. I am now trying to form a sketch that will trigger an OUTPUT to high at a specific time, but am getting errors when I upload a sketch.

My question is; Since I have the Ethernet Shield in the stack, but am not focusing my sketch on using the Ethernet Shield just yet, do I need to #include it in my declarations so that I can successfully upload a timer sketch?

The first phase of my project will be the Mega connected via cat5 and passive POE. In the circuit will be an 8 channel relay board and 2 DHT sensors. So I'd like the ability to view the sensor data over a network, and also program 4 of the 8 channels to be cycled on at specific times for specific durations, and possibly cycle at least one of the remaining relay channels based upon variables collected from the DHT sensor. I expect it to be a while before I tackle all of that, but for right now I am focusing getting a time stamp in the serial monitor to trigger LEDs from an output, as I understand that lighting the LED will represent the relay channel when I get my sketch functioning properly.

myggle: Ethernet Shield and a Data Logging/RTC shield.

If you want to keep it as a secret which shield products you are actually talking about, it will most likely stay a secret if they might be compatible or not for stacking, too.

This might be your "Ethernet-Shield".

But I'm unable to guess the "data logging shield".

, but am getting errors when I upload a sketch.

Sharing the content of the errors helps us to help you fix them.

I neglected to jot down what exactly the errors said, so recreating the exact failure might be a little tricky. The Data Logging Shield with RTC is an Adafruit and the ethernet shield is a clone I got from newegg with the Mega clone.

Just so that I might know, if you were wanting to write a sketch that will only utilize one shield while the other shield was still pinned to the stack, would you #include the library for the unused shield? I'm trying to understand the relation between sketch and hardware used vs. hardware included.

Yes, don't #include anything for the un-used shield. So long as you aren't trying to use those pins, the attached shield will have no effect on your program.

MorganS: Yes, don't #include anything for the un-used shield. So long as you aren't trying to use those pins, the attached shield will have no effect on your program.

Thank you for clearing that up for me.

myggle: The Data Logging Shield with RTC is an Adafruit

So this PDF is made for your information.

The SD card on the datalogger will be of little use for you: It will be very complicated to use with a MEGA and the card would be very slow in reading and writing after everything has been patched and made compatible for MEGA. The SD on the datalogger is not really of any use if you have an Ethernet shield.

So you'd better use the SD card slot on the Ethernet shield with your MEGA.

The only little thing what might be useful from your datalogger shield is the RTC.

Your datalogger shield is just a very expensive RTC module for you.

From what I see at the moment, there should be no hardware conflicts when stacking the Ethernet shield and the data logger shield on an Arduino MEGA. But without any effort you will be only able to use the SD card slot on the Ethernet shield with the default SD library.

The better and cheaper hardware addition for an Arduino MEGA would have been: - Ethernet shield - RTC-module

When I tested them individually, I was able to verify the SD slot did recognize my card, but when I tested the ethernet shield, it wouldn't recognize my micro SD card. This could have been simply that the SD card accepted the formatting correctly and the micro SD didn't. I bought the data logging shield for the RTC, but a functioning SD reader is just a plus. I already have the shield so it would be pointless to return the product to try and capture the difference in value, especially since the SD card reader tested and passed.

myggle: When I tested them individually, I was able to verify the SD slot did recognize my card, but when I tested the ethernet shield, it wouldn't recognize my micro SD card.

When I test shields with SD card slot or SD card modules on breakout boards, it would recognize the micro SD card in any case.

If the cabling is correct (you cannot do much wrong with shields) it must be the software, who does the job. Or maybe does not the job.