RCTime running for two pins

Hello,

I have this code running to get values out of pins. Currently I can only get SensorOne to work. I can initialize sensorTwo, but I can't get the rest of the code to work?

#include 

int sensorOne = 11;    // 220 or 1k resistor connected to this pin
int sensorTwo = 12; 
long result = 0;
void setup()                    // run once, when the sketch starts
{
   Serial.begin(115200);
   Serial.println("start");      // a personal quirk 
}
void loop()                     // run over and over again
{
  // Serial.println("one:" );
   Serial.println( RCtime(sensorOne) );
   delay(10);


}

long RCtime(int sensPin){
   long result = 0;
   pinMode(sensPin, OUTPUT);       // make pin OUTPUT
   digitalWrite(sensPin, HIGH);    // make pin HIGH to discharge capacitor - study the schematic
   delay(1);                       // wait a  ms to make sure cap is discharged

   pinMode(sensPin, INPUT);        // turn pin into an input and time till pin goes low
   digitalWrite(sensPin, LOW);     // turn pullups off - or it won't work
   while(digitalRead(sensPin)){    // wait for pin to go low
      result++;
   }

   return result;                   // report results   
}

adding this bit causes the serial output to stop after one loop

void loop()                     // run over and over again
{
   Serial.println("one:" );
   Serial.println( RCtime(sensorOne) );
   delay(10);
   Serial.println("two:" );
   Serial.println( RCtime(sensorTwo) );
   delay(10);

}

Why are you including the Firmata header file?

What kind of sensors are they?

My suspicion is that the 2nd sensor is not working correctly. Does any thing change if you switch the order? That is, get data from sensor 2 first, then sensor 1.

hmm, yes, if I use the original code and switch sensorOne and sensorTwo ,then it does not output in the serial Monitor. I am unfamiliar with RCTime, so I wasn't sure if the code was compatible with more than one sensor.

Its a 2-axis joystick by parallax http://www.parallax.com/tabid/768/txtSearch/27800/List/0/SortField/4/Default.aspx

The fermata header is because this will eventually need to go to flash.

hmm, yes, if I use the original code and switch sensorOne and sensorTwo ,then it does not output in the serial Monitor.

Not even the start statement?

That code looks similar to the ping sensor code, where the sensor is activate to send a pulse, and then wait for a return.

I can't envision how a joystick would do anything like that.

That joystick looks suspiciously like a simple two axis pot - any reason for not using an analogue input?

the start code and text string works, then stops when trying to print sensorTwo.

AWOL - I just started using Arduino...I'd love to use analog and understand how to get values from analog pins. Do you have a link to a tutorial for this? Its a bit hard to navigate through all the information available on the Arduino site.

http://arduino.cc/en/Tutorial/AnalogInput