Hi all. Please help me figure it out. I define, say, pin 0 as the input. In the serial port, I see noise 0101010101010 and so on. When I connect a 100k resistor to ground and to pin 0, the port outputs 000000. When I touch the wire previously soldered to pin 0 with my finger, I see 11111 and so on, but this does not last long. After some time, pin 0 does not respond and starts to issue 000000 again and so on. I want it to be 1 when touched and 0 when released
That pin (RX) is typically connected to the USB circuitry and a bad candidate for reliable experiments.
I think that you are about to discover the difference between DC and AC. Everything connected to a pin, maybe a loose wire or finger, can catch up ambient electrical noise. That's AC and just the detection of noise at the pin indicates a connection. Now you can start writing code to convert the noise on/off detection into a stable true/false input indication.
If you want to use your arduino input as a touch sensor, google "arduino touch sensor" and you should get tons of hits.
Thanks everyone, I think I figured it out. 1 mega ohm resistor saved the situation ![]()
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.