EDIT: Disregard. Problem solved. Need to connect pull-up resistored switches to ground, not 5V. I get it. :o
I am having problems getting readings from my tilt sensor.
I have the sensor between the 5V rail of a computer PSU and analog pin 0 (is this dangerous?). The ground of the PSU is common with the arduino ground. There is about 5ft of wire connecting the sensor if that makes a difference, but I've double checked all the connections and I know they all work.
I'm hoping that when the tilt sensor is down (off) it will disconnect the 5V and a digitalRead(A0) will be LOW. When it is up (on), digitalRead(A0) should be HIGH.
However, that is not happening.
I've tried the internal pull-up resistor trick (set the pin to INPUT then digitalWrite HIGH) the pin is always high and I can't get it low, even if I disconnect the sensor, turn off the PSU, or disconnect the A0.
The same happens without the pullup resistor trick.
I've been using the code from this forum and my own.
What's going wrong?!