I have a Mega2560 with an Ardiuno ethernet shield with an LCD shield all stacked. The LCD is an HD44780 found here: http://www.dfrobot.com/index.php?route=product/product&product_id=51
I have the following code:
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8,9,4,5,6,7);
const int chipSelect = 4;
void setup()
{
lcd.begin(16, 2);
lcd.print("Initializing SD card...");
// make sure that the default chip select pin is set to
// output, even if you don't use it:
pinMode(10, OUTPUT);
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
lcd.print("Card failed, or not present");
// don't do anything more:
return;
}
lcd.print("card initialized.");
}
Everything is working great until I set pin 10 and then my LCD turns off. As near as I can tell, the LCD doesn't use pin 10.
The example says that pin 10 is a chip select. Can you only use the ethernet or the SD at a time? If so, do you/can you switch back and forth at runtime?
Also, I am running the hardware solely on USB (no power source) and have experienced some voltage sag before, could I be exceeding the available power on the USB? I have no idea how much current these things draw.