Author Topic: Arduino digital read  (Read 2859 times)

0 Members and 1 Guest are viewing this topic.

Offline UstaryTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 0
Arduino digital read
« on: February 18, 2011, 02:52:23 PM »
Hi. For my robot i need some contact switches working with an arduino. The switches are copper and alluminuim, and work pretty well, with barely any resistance at all. on the parts that shouldn't conduct, i use ductape. The problem is, sometimes the digitalred of my arduino returns 1 instead of 0 even if the contacts are seperated by ductape. Can someone help me solve this? these contacts are a vital part of my robot...

Thank you

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,944
  • Helpful? 99
Re: Arduino digital read
« Reply #1 on: February 18, 2011, 03:05:47 PM »
Do you have a pull-down resister on the input pin to ensure that the logic level is 0 when the switch is open?

Offline UstaryTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 0
Re: Arduino digital read
« Reply #2 on: February 19, 2011, 02:10:35 PM »
No, there is no said resistor. How would i go about doing this?

Thank you

Offline blackbeard

  • Supreme Robot
  • *****
  • Posts: 575
  • Helpful? 4
Re: Arduino digital read
« Reply #3 on: February 19, 2011, 02:43:58 PM »
No, there is no said resistor. How would i go about doing this?

Thank you

the resistor is there so that a logic level of 0 or 1 is always maintained. digital logic becomes unstable (hence the erroneous 1s) when pins arn't tied down to one or the other. if your switch ties the pin to ground lets say then the resistor (2.2k should work) would go to +5v
"sure, you can test your combat robot on kittens... But all your going to do is make kitten juice"

First step: Build androids with AI
Next step: Give them vaginas

Offline UstaryTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 0
Re: Arduino digital read
« Reply #4 on: February 19, 2011, 02:58:58 PM »
Thank you for the reply. I'll try to get some resistors, and experiment with them.