Serial.print() problem Please Help

ok, so im building a soccer robot, and currently while im programmig it im using serial.read() to make sure everything is functioning normal.

My problem is that after about a minute it pronts out something like this
Output: Voltage: 0.10 Volts -noball
Output: Voltage: 0.08 Volts -noball
Output: Voltage: 0.07 Volts -noball
Output: Voltage: 0.05 Volts -noball
Output: Voltage: 0.08 Volts -noball
Output: Voltage: 0.1

and then stops reporting any more values. My code is this
// this constant won't change:
const int buttonPin = 2; // the pin that the pushbutton is attached to
const int ledPin = 13; // the pin that the LED is attached to
int irPin0 = 0; // the cell and 10K pulldown are connected to a0
int irReading0; // the analog reading from the analog resistor divider
int irPin1 = 0; // the cell and 10K pulldown are connected to a0
int irReading1; // the analog reading from the analog resistor divider
int irPin2 = 0; // the cell and 10K pulldown are connected to a0
int irReading2; // the analog reading from the analog resistor divider
float Res0=1.0;// Resistance in the circuit of sensor 0 (KOhms)
// depending of the Resistance used, you could measure better at dark or at bright conditions.
// you could use a double circuit (using other LDR connected to analog pin 1) to have fun testing the sensors.
// Change the value of Res0 depending of what you use in the circuit
// Variables will change:
int buttonPushCounter = 0; // counter for the number of button presses
int buttonState = 0; // current state of the button
int lastButtonState = 0; // previous state of the button

#include <CompactQik2s9v1.h>
#include <NewSoftSerial.h>

#define rxPin1 3
#define txPin1 4
#define rstPin1 5

#define rxPin2 6
#define txPin2 7
#define rstPin2 8

NewSoftSerial mySerial1 = NewSoftSerial(rxPin1, txPin1);
CompactQik2s9v1 motor1 = CompactQik2s9v1(&mySerial1,rstPin1);

NewSoftSerial mySerial2 = NewSoftSerial(rxPin2, txPin2);
CompactQik2s9v1 motor2 = CompactQik2s9v1(&mySerial2,rstPin2);

void setup() {
// initialize the button pin as a input:
pinMode(buttonPin, INPUT);
// initialize the LED as an output:
pinMode(irPin0, INPUT);
pinMode(irPin1, INPUT);
pinMode(irPin2, INPUT);
// initialize serial communication:
Serial.begin(9600);
mySerial1.begin(9600);
mySerial2.begin(9600);
motor2.begin();
motor1.begin();
motor1.stopBothMotors();
motor2.stopBothMotors();
}

void loop() {

irReading0 = analogRead(irPin0); // Read the analogue pin
float Vout0=irReading0*0.0048828125; // calculate the voltage
irReading1 = analogRead(irPin1);
irReading2 = analogRead(irPin2);

Serial.print("Output: ");
Serial.print("Voltage: "); // Print the calculated voltage returned to pin 0
Serial.print(Vout0);
Serial.print(" Volts\t");

if (irReading0 > 100) { // check left Ir sensor.
Serial.print(" - BALLLEFT"); // ir 1
motor1.motor0Reverse(200);
motor1.motor1Forward(200);

delay(100);
motor1.stopBothMotors();
motor2.stopBothMotors();
delay(100);

}
else{
if (irReading1 > 100){
Serial.print(" - BALLFRONT"); //ir 2

delay(100);

}
else{ if (irReading2 > 100){
Serial.print(" - BAllRIGHT");// ir 3
motor1.motor0Forward(200);
motor1.motor1Reverse(200);

delay(100);}

else{
Serial.println("-noball");
loop();
}}}
Serial.

delay(100);//end of button loop
}

from my other testings i have found that each part of the program works fine, it is only this one bit that im having trouble with, and i cant keep working on my robot without this.

thanks for any help offered
Jake

What are the two NewSoftSerial instances for?

      loop();

Unless you have a really good reason for this, and know exactly what you are doing, and why, you should NEVER call loop() from inside of loop(). You are most likely running out of memory because of this recursive call.

Ah thanks, now i understand, i was working on the theory that it would jump the program back to the start of Void loop(), similar how an event works, but wasnt 100% sure, i didnt realise that it would send it into a perpetual loop. so i guess my real question is is there a way to send it back to the start of void loop() with out going into an endless loop?

When the loop function ends, it will be called again. If you want to end some particular iteration of loop, prematurely, use return. Much better, though, is to structure the code so that what you want to happen happens only when you want it to, through appropriate use of if/else if/else, for, and while statements.

Ok, last question, on review, if i go to an event, and the event finishes will it start the event again, or go back to the start of void loop?

Thanks for all your help, its gonna make my systems teacher alot happier

What do you mean by event? If you mean function, then neither of your scenarios is correct. The function will end, and return to where it was called. The next statement will then be executed.

Sorry i believe ive figured it out, i was referring to the functions defined by something like forward() and then it jumps to void forward()

whats happened is my teacher has given me some code examples and then ive had to figure it out for myself.

I cant believe im doing this but your help is invaluable, and im just curious before i write more of my program, whether you can run multiple functions inside of each other, so in this case if i was running the forward function, and inside it i have an if statement, where if the light is > than 10 or < than 10, and one side tells it to go to turn() and the other tells it to go to forward() which is the start of the function, would this work or would i have to write the program in a way that makes it work without the functions.

Sorry, your help is amazing, and ive been struggleing to find accurate help for my programs.

A function should perform a single task. A function, like forward(), should do its thing (whatever that is) and return. Most likely, forward() should start the robot moving forward.

It really should not be part of forward()'s mission in life to also initiate turns. That should be done by loop().

Of course, this does not mean that it can't, but it is a lot easier to keep the action separate from the decisions as to what action to take.

So, loop() should make the decisions, and call functions to implement those decisions.

As your programs get larger, you will start to build functions that call other functions. Perhaps, you might have a function forwardWithBlinkingLights() that calls forward() and blinkingLights(), each of which do a single thing. But, for now, keep to the one function, one action mindset, and your programming will be much easier, more maintainable, and more pleasant.