Crosstalk when using PWM according to measured RC timedelay.

Hello, all!

Recently I tried to use PWM to generate analog signal depending on the sensor signal.

I prefer to use analog input instead digital pin. However, my resistive type sensor has very low sensitivity, so I had to use indirect sensing method, sensing RC time delay as well described in http://arduino.cc/en/Tutorial/RCtime.

I could acquire sensor signal well using the RCdelay method.

Now, I wanted to control the PWM port according to the sensor signal, so I uploaded code as below.

int sensorPin = 4;// 220 or 1k resistor connected to this pin
int actuatorPin = 11;
int sensorval = 0;
int pwm=0;
void setup()                    // run once, when the sketch starts
{
   Serial.begin(9600);
   Serial.println("start");      // a personal quirk 
   pinMode(actuatorPin, OUTPUT);
}

int RCtime(int sensPin){
   int 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   
}

void loop()                     // run over and over again
{
   sensorval=RCtime(sensorPin);
   Serial.println(sensorval);
   pwm=map(sensorval,4750,4900,0,255);
   analogWrite(actuatorPin, pwm);   
   delay(10);
}

After upload, sensor signal was still good. However, once I hooked up a wire to the PWM port, sensor signal was gone and only noisy signal remained. The other end of wire wasn't connected anywhere.

Is it normal to have crosstalks between digital pins in arduino?

I used Arduino mini pro 3.3V

No there should not be cross talk unless we are talking about a very tiny amount of micro volts or something.