Help : Simple reed switch that I can't read !

I'm trying to read the pulses from a reed switch sensor with one arduino duemilenove(see scheme here below). The reed switch sensor is integrated in other mechanism and powered with 3.3V (I can not modified this) and I power the arduino board with 5.0V using the usb cable (in order to make also the monitoring). The reed switch sensor pinout provide the values in low active logic (so I need to count each time the reading reach the value 0).

Ext. Mechanism Arduino RSWPin ---------------------------------------------------Digital Pin 2

GND-----------------------------------------------------------Gnd

I tried first with the following code (trying to read that values from a digital pin) :

int pinReed = 2;
int ReedValue = 0;      

void setup() {
 Serial.begin(9600);
 pinMode(13, OUTPUT);   
 pinMode(2, INPUT);   
}
void loop()
{
 ReedValue=digitalRead(pinReed);   
 if (ReedValue==LOW) {
   digitalWrite(13, HIGH); 
   Serial.println("Pulse detected");
 } else{
   digitalWrite(13, LOW);
   Serial.println("Waiting...");
 }
}

It didn't work , until here I can understand as the reed switch sensor is powered at 3.3V the logical values aren't well interpreted and normally there're only 0 logic values if reed switch is not acting, so fake detections (even if there're almost 1/5 that is detected as high value also)

But what is strange for me is the following trying to see at least which are the analog values that arrives to the board with the cable to be sure what is the prb :

int pinReed = 3;
int ReedValue = 0;      

void setup() {
 Serial.begin(9600);
 pinMode(13, OUTPUT);   
 pinMode(3, INPUT);   
}
void loop()
{
 ReedValue=analogRead(pinReed);   
 Serial.print("Value ==> ");Serial.println(ReedValue);
}

Even if the reed sensor is not acting I see that values go from 0 to 1024 all the time (as something random) .

Do you know what I'm doing wrong ?

It seems I'm not reading correctly the values from RSWPin ...

Pull-up/down resistors fitted? I'm guessing not.

Why are you using analogue reed for a reed switch? You just need a digital input. This project uses reed switches:- http://www.thebox.myzen.co.uk/Hardware/Pendulum.html

It is this comment that makes no sense:-

The reed switch sensor is integrated in other mechanism and powered with 3.3V

A reed switch is a magnetic sensing switch and as such what ever powers it is irrelevant because all you get out is a contact closure. So I am not too sure exactly what is going on here.

Consider going back to basics... check the voltage going to the Arduino input pin with a voltmeter with the switch open, and with it closed.

Thanks all, here are some test I did with your sugestions . I'd try to response your questions also :

@AWOL : I've used the pull-up/down internal resistors in Arduino after your suggestion The result when I use the internal pull-up is that value is always the same (never changes = 1 logic value) and we I use the internal pull-down the value change randomly from 0 to 1 (even with reed switch open)

@Grumpy_Mike : I used only analog input to read the voltage . As you say I need to read

@Richard_Crowley : I attach the scheme describing the way I'm reading exactly the reed switch (from an appliance)

@tkbyd : Yes, you're right . I did it . Value in the pin is always 0,06V (even with reed switch closed but maybe the time of the signal is too short to be measured in this way..)

I'm still lost , Do you have some idea ?

Yes it would be better if you could tell us exactly what you have. Despite what you said earlier it is quite clear from the schematic that you are not reading a reed switch with the arduino. What you are doing is reading some logic gate that further back down the line is supposedly being controlled by a reed switch. You only show one point on that schematic labelled reed switch, where is the other end of the switch going? There are not values on all the resistors so it is impossible to see if a switch to ground of a reed switch at that point will trigger the gate. Assuming you have connected the grounds together the failure to see anything change on your analogue input is due to the malfunctioning of the circuit you posted. That circuit just seems to be full of delays, if the switch is being closed only briefly maybe it is not being closed long enough to actually get through all those delays.