odd Serial output in real world applicatioin

I have rode the bike a lot with this control hooked up and it has worked very well but yes there are fail safes in place.

OK, I have completed my cruise control device and under bench test conditions it works perfect.

On the bench with my mach up controls, the RPM reading seems to be very good but when I attach the unit to the bike and pull the clutch or brake lever I am getting RPM readings thru the Serial.print, very erratic readings. I should not get any rpm reading from these switches going high. They are only active when the main loop (throttleLoop) sends the program to a second loop (cruiseLoop).

Here is some background;
125 pulse optical rotary encoder to pick up throttle position
2 buttons to set the current throttle position and advance or retard the throttle position if pushed more than once.
These two buttons also cause the program to take a snapshot in time of the current RPM of the real wheel.
2 buttons attached to clutch and brake to release the control back to the rotary encoder
1 Hall sensor attached to the back picking up input from two magnets 180* out from one another attached to interrupt pin 1
1 servo taking the inputs from the rotary encoder or first two buttons controlling the throttle position
2 identical micro controler units wired the same. One as a back up to the other and for bench testing
Mach up control panel wired the same as the actual controls on the bike. One exception is that the brake and clutch are operated via a relays.
the relays are activated by the brake and clutch lever switches. the relays are double pole single throw.

Program monitors the wheel speed and when either of first two buttons are pushed the snap shop rpm for reference is taken and then the program adjusts the throttle position on its own to maintain speed.

The program all works perfect as far as throttle control.

I know this is obviously hardware related, probably in the wiring but since the program should not even be looking at brake and clutch in the throttleLoop, I am very confused how it is producing an RPM reading.

#include <Bounce.h>
#include <Servo.h>
void loop()
{
  throttleloop();
}
/////////////RPM ATTACHINTERRUPT///////////////////////////
volatile byte rpmcount = 0;///////////////AttachInterrupt for reading 
int currentRPM = 0;///////RPM off of front wheel
unsigned int rpm = 0;/////////////to use in cruiseLoop and
unsigned long timeold = 0;///////////////adjust speed to monitor 
unsigned long cruiseTime = 0;/////////Time used to enter preInterruptLoop
int fixedRPM = 0;//////////////////fixed RPM reading to compare old to current
int mph = 0;
double pi = 3.14159;
double wheelDia = 25.5;
double wheelCirc = (pi*wheelDia);
//////////////////////////////////////
unsigned long startPress=0;
Servo throttleServo; // Define throttle Servo
int servoPos = 30;    // Initial power up “servo position”
int moveServoAmount = 1;    // move the servo 1 degrees per 1/125 pulse
int moveServoAmount2 = 3;    // move the servo 1 degrees per 1/125 pulse
const int pin_ThrottleUp = 4;
const int pin_ThrottleDn = A2;  // pin 14
unsigned char encoder_ThrottleUp;
unsigned char encoder_ThrottleDn;
unsigned char encoder_ThrottleUp_prev=0;

// set pin numbers:
const int speedUpPin = 11; // the number of the pushbutton pin
const int speedDnPin = 10;
const int clutchPin = 8;
const int brakePin = 9;

long debounceDelay = 50;    // the debounce time; increase if the output flickers

//Debounce objects
// Instantiate a Bounce object with a 5 millisecond debounce time
Bounce cruiseUp = Bounce(speedUpPin, debounceDelay);
Bounce cruiseDn = Bounce(speedDnPin, debounceDelay);
Bounce brakeReleaseToThrottle = Bounce(brakePin, debounceDelay);
Bounce clutchReleaseToThrottle = Bounce(clutchPin, debounceDelay);

void setup()  {
  Serial.begin(9600);
  throttleServo.attach(12); // servo on digital pin 12
  throttleServo.write(30);
  pinMode(pin_ThrottleUp, INPUT_PULLUP);
  pinMode(pin_ThrottleDn, INPUT_PULLUP);
  // initialize the pushbutton pin as an input:
  pinMode(speedUpPin, INPUT_PULLUP); 
  pinMode(speedDnPin, INPUT_PULLUP); 
  pinMode(clutchPin, INPUT_PULLUP); 
  pinMode(brakePin, INPUT_PULLUP);
  attachInterrupt(1, rpm_fun, RISING);
} 

void throttleloop()  {
  {
    if (rpmcount >= 20) { 
      //Update RPM every 20 counts, increase this for better RPM resolution,
      //decrease for faster update
      rpm = 30*1000/(millis() - timeold)*rpmcount;
      timeold = millis();
      rpmcount = 0;
      Serial.print("RPM");
      Serial.println(rpm,DEC);
      mph = ((rpm*60*(wheelCirc))/5280);
      Serial.print("MPH");
      Serial.println(mph,DEC);
    }
  }
  //Update debounce tool
  cruiseUp.update();
  cruiseDn.update();
  brakeReleaseToThrottle.update();
  clutchReleaseToThrottle.update();
  //Do not need to update these here are they are not used
  //bouncer3.update();
  //bouncer4.update(); 
  encoder_ThrottleUp = digitalRead(pin_ThrottleUp); // Read encoder pins
  encoder_ThrottleDn = digitalRead(pin_ThrottleDn); // Read encoder pins
  if(encoder_ThrottleUp != encoder_ThrottleUp_prev) {
    if (encoder_ThrottleUp == encoder_ThrottleDn) {
      if(servoPos + moveServoAmount <= 90) servoPos += moveServoAmount;   // advance throttle
      else{
        if(servoPos + moveServoAmount >= 91 && servoPos + moveServoAmount < 200) servoPos += moveServoAmount2;
      }
    }
    else {
      if(servoPos - moveServoAmount >= 91) servoPos -= moveServoAmount2;  // decrease thrott
      else{
        if(servoPos - moveServoAmount <= 90 && servoPos - moveServoAmount >= 20) servoPos -= moveServoAmount;
      } 
    }
  }
  encoder_ThrottleUp_prev = encoder_ThrottleUp;     // Store value of A for next time
  // set the new location of servo:
  throttleServo.write(servoPos);
  if (cruiseUp.read() == HIGH)
  {
    cruiseLoop(); //Enters button control loop
  } 
  if (cruiseDn.read() == HIGH)
  {
    cruiseLoop(); //Enters button control loop
  }
}
/**
 * If button control is enabled, loop and handle control buttons
 * If exit buttons (To return to pot control) are pressed, exit loop and return
 * to pot control
 */
void cruiseLoop(){    
  servoPos = throttleServo.read(); //reads current servo location 
  int btnControlEnabled = 1; //If button control is enabled this equals 1, else it equals 0 
  while(btnControlEnabled == 1)
  {
    if (rpmcount >= 20) 
    { 
      //Update RPM every 20 counts, increase this for better RPM resolution,
      //decrease for faster update
      rpm = 30*1000/(millis() - timeold)*rpmcount;
      timeold = millis();
      rpmcount = 0;
      Serial.print("RPM");
      Serial.println(rpm,DEC);
      {
        if (currentRPM > rpm){
          throttleServo.write(servoPos -= 1);
        }
        if (currentRPM < rpm){
          throttleServo.write(servoPos += 1);
        }
      }
    }
    //Update all debounce tools
    cruiseUp.update();
    cruiseDn.update();
    brakeReleaseToThrottle.update();
    clutchReleaseToThrottle.update(); 
    if (cruiseUp.read() == HIGH)
    {
      currentRPM = rpm;
      Serial.print(currentRPM);
      Serial.println("currentRPM");
      throttleServo.write(servoPos + 1); //Add 2 degrees to servo position for increased motor rpm
      servoPos = throttleServo.read();
      delay(200); //allows time for switch ro reset
    }
    //If first button not pressed, check the next...
    else if (cruiseDn.read() == HIGH)
    {
      currentRPM = rpm;
      Serial.print(currentRPM);
      Serial.println("currentRPM");
      throttleServo.write(servoPos - 1); //Subtract 2 degrees to servo position for decreased motor rpm
      servoPos = throttleServo.read(); //Read new servo position
      delay(200); //allows time for switch ro reset
    }
    else if (clutchReleaseToThrottle.read() == LOW & (brakeReleaseToThrottle.read() == LOW))
    {
      startPress = 0;
    }
    else if (startPress == 0){
      startPress = millis();
    }
    else if (millis() - startPress > 200)
    {
      servoPos = 30;
      btnControlEnabled = 0; //Set loop exit condition
    }
  }

  throttleloop();

}


void rpm_fun(){

  rpmcount++;
  //Each rotation, this interrupt function is run twice
}

Cars and bikes are notoriously noisy electrical environments. What precautions are you taking to prevent electrical noise affecting your circuit ? How is the Arduino powered ?

powered by regulated 7 VDC via a Castle BEC http://www.castlecreations.com/products/ccbec.html

I would still suspect electrical noise, particularly as you say it works OK off the bike. If the problem occurs without the bike running then like you I would suspect a wiring fault, but I assume that you have checked that. Does the problem occur on the bench when using the BEC to provide power ?

Reading your code, it seems that under some circumstance the throttleloop function calls the cruiseLoop function and the cruiseLoop function unconditionally calls the throttleloop function. This does not seem a good idea. When the cruiseloop function is finished why not let it just return to where it was called from ?