Arduino Mega requires reset to work

Hey All! Been working on Arduinos since March and due to a lot of info on these boards, I have a pretty decent project that’s doing well. I have encountered a snag though.

I have an Arduino Mega working with a motor controller board, a self-made power distribution board, and an Arduino Uno hooked up with a Sparkfun microSD shield. The Mega uses I2C to talk to the Uno, and the Uno reads the only file on the microSD card, turns it into an array, and feeds the values back to the Mega. The Mega then uses the array to run a motor in a pattern.

I can get the Uno to talk to another Uno without a hitch. The Mega in the project works just fine on its own. Once I connected it to the Mega, I get nothing (not even serial responses). I push the reset button, wait a few seconds, and then the project works as expected.

It seems weird that I do not get an instant reset response. Without the microSD shield and Uno connected the Mega runs just fine. Any suggestions? What info will you guys need?

I reviewed the device and tried using an older code with the same hardware setup: the device worked fine. It seems to be a coding issue, so here’s the code I have:

//include wire library
#include <Wire.h>

//set SDcard address
const int SDcard = 1;

//variable to note if initialization passed
boolean initPassed = false;

//to calculate incoming encoded ints
byte master_packet[2];[/color]

//breath waveform
//Waveform is the number of steps per instance where Speed is the delay in milliseconds per interval
//Speed cannot be negative
//Negative Steps reverse the direction
int standardWaveform [300];        //the breathing waveform in motor counts
long standardSpeed = 0;            //time in ms per instance
int standardSize = 0;              //sets the array size

const int dirPin = 22;		//LOW = CW, HIGH = CCW
const int stepPin = 23;		//used to microstep the motor
const int motorPin = 24;	//HIGH enables motor, LOW disables motor
const int homePin = 25;	        //tells if the motor is at the home position  OPEN == HIGH, CLOSED == LOW

int stepNumber = 0;
int currentStep = 0;
long stepDelay = 0;
int motorPosition = 0;
int addPosition = 1;

void setup(){
        //troubleshooting code
        delay(1000);  //delay 1 second
	//disable the motor prior to initializing
	pinMode(motorPin, OUTPUT);          //set the motor pin as an output
	digitalWrite(motorPin, LOW);        //set the pin's voltage low to disable the motor

	//initialise I2C with motor board as master
	Wire.begin();  //master has no address	

        //run a test read to purge the bad data
        initPassed = testSdCard();
	//call funcion to read array and receive arrary size
	standardSize = getSdArray(&standardWaveform[0]);
        standardSpeed = standardWaveform[0];
	//Serial.print the array to confirm it was received properly
	Serial.print("\nArray Aquired!\nSpeed is: ");
        Serial.print("\nBreath Wave size is: ");
	for (int i = 1; i < standardSize; i++)

	//initializing pins
	pinMode(stepPin, OUTPUT);	    
	pinMode(dirPin, OUTPUT);            
	pinMode(homePin, INPUT);            
	//move the motor to the start position
	digitalWrite(dirPin, LOW);	//set direction CW
	digitalWrite(motorPin, HIGH);	//enable the motor

        //moving motor to the lowest position
	while (digitalRead(homePin) == HIGH) {
		digitalWrite(stepPin, HIGH);  //step the motor
		digitalWrite(stepPin, LOW);   //prepare for another step
		delayMicroseconds(400);       //wait in microseconds

 	digitalWrite(dirPin, HIGH);	//set direction CCW
        for (int x=0; x < 7000; x++){
                digitalWrite(stepPin, HIGH);  //step the motor
		digitalWrite(stepPin, LOW);   //prepare for another step
		delayMicroseconds(500); //wait in microseconds




When starting the device, it won’t even display “Begin!” until I reset it. I can only guess that this is a Wire I2C issue.