How to prevent wrong values in Digital reading?

I'm trying to interpret some values of a possible SPI or I2C interface (I'm not sure yet) trying to read the values from the lines in arduino digital inputs using interruptions to detect the activation on the line. The problem is that I read "random" values (as electrical noise, I suppose that because even a little movement in the table trigger the signal) and I can not make the difference between the wrong and the right detected values.

I'm connecting the cables from the other part interface directly to the digital inputs in Arduino. Should I protect/filter them in some way before the reading?

Do you know a method to make this kind of diagnostic in a most proper way?

Thanks in advance

Start off with describing what hardware you have, perhaps even post a schematic. Then describe or post the software and finally describe what is going wrong.

I am sorry but what you posted is very difficult to read.

You're right . I try to explain it better. The hardware I'm using is Duemilenova + Ethernet shield and in the other side I've a kind of gamepad with a RJ45 conector with the 8 wires : GND,RXD,TXD,READY,cSW1,cSW2,cSW3,CONTROL

I want to detect when cSW1,cSW2,cSW3 and 'CONTROL' are activated (HIGH)

By example to detect the 'CONTROL' I connect :

Gamepad Arduino COMMAND --- D2 (Interrupt 0) GND --- GND

The code I try to use to detect (whith interruptionAttach) when the wire ('CONTROL') is activated is the following :

volatile int state = LOW;
int ledPin = 13; 

void detectSignal()
{
     Serial.println ("DETECTED!");
     state = !state;  

}

void setup()
{
  Serial.begin(9600);       
  pinMode(ledPin, OUTPUT);  
  attachInterrupt(0, detectSignal, FALLING); //I use interruption 0 (pin D2)
  
}
void loop()
{
  digitalWrite(ledPin, state);
}

The problem is that there's a detecttion even when there're little vibrations on the table and I can not be sure when I'm detecting correctly the signal . What I'm doing wrong ?

OK several things don't stack up here. You say:-

Duemilenova + Ethernet shield and in the other side I've a kind of gamepad with a RJ45 conector with the 8 wires

So are you connecting this game pad to the Ethernet shield? If so you have no code in your sketch to talk to the Ethernet shield. Also it is unlikely that the RJ45 on a games pad is Ethernet. What sort of games pad is it?

Now the code, there is no need to use that attach interrupts here you are only making things more complex. Also it is not a good idea to print in an interrupt service routine. By D2 do you mean Pin2? You have not initialised this as an input, but it defaults to an input anyway. However you could do with enabling the internal pull up resistors, it sounds to me like the input pin is just floating.

I want to detect when cSW1,cSW2,cSW3 and 'CONTROL' are activated (HIGH)

How are they ever going to be high if no power is supplied to them, all they can ever do is be active low.

You need more information on your game pad.