Tinker Board Forum

Full Version: [ANSWERED] Correct wiring of input pins
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Edit (Thanks to Jamess):

An input pin reacts to either ground or +3.3V

Ground ==> False
+3.3V ==> True
Nothing ==> Either True or False (Undefined)



Original post:



Hey!

I am playing around with the input mode on the Asus Tinker, and one of my pins is acting up, breaking my scripts.

Normally my pins react (True / False) when connected to ground or not, this pin I am talking about suddenly does the mentioned when connected to +3.3V instead.

The pin is always outputting False while the others are outputting True, giving a True when connected to +3.3V, while the others gives a False when connected to ground.

None of the mentioned pins are bent, and nothing is connected to them.


Programming language used is Python 2



Code:
import ASUS.GPIO as GPIO

GPIO.setwarning(False)
GPIO.setmode(GPIO.ASUS)

GPIO.setup(166, GPIO.IN)
print( str( GPIO.input(166) ) )

GPIO.cleanup()

This is the following code I am running, and "166" is the pin which is acting up. You can see the pin in the image below:

[Image: IGcWk2r.png]


I'm really unsure about this behavior and have been debugging for hours. Can someone point me in the right direction?

With kind regards,
Frekvens1
(11-26-2017, 06:41 PM)Frekvens1 Wrote: [ -> ]Hey!

Programming language used is Python 2



Code:
import ASUS.GPIO as GPIO

GPIO.setwarning(False)
GPIO.setmode(GPIO.AS)

GPIO.setup(166, GPIO.IN)
print( str( GPIO.input(166) ) )

GPIO.cleanup()


With kind regards,
Frekvens1

Hi, Frekvens
    Sorry, I do not understand what you mean. The GPIO should be return true when it connects to 3.3V and return false when it connects to ground.
    You mean sometimes it return false when it connects to 3.3V and vice versa ?
Hey Jamess!

Thanks for the reply! I'll try be more clear.

Normally, the pins gets False when connected to ground, and stays True when nothing connected.

This pin stays False, becomes True when connected to +3.3V.

From what you are saying, none of my pins behave like they should. Do you know of any solutions to set them to standard? Perhaps using GPIO.BOARD?

With kind regards,
Frekvens1
(11-27-2017, 12:16 PM)Frekvens1 Wrote: [ -> ]Hey Jamess!

Thanks for the reply! I'll try be more clear.

Normally, the pins gets False when connected to ground, and stays True when nothing connected.

This pin stays False, becomes True when connected to +3.3V.

From what you are saying, none of my pins behave like they should. Do you know of any solutions to set them to standard? Perhaps using GPIO.BOARD?

With kind regards,
Frekvens1

1. connect to ground ==> flase
2. connect to +3.3V  ==> true
3. connect nothing  ==> It's un-define because the pin is floating, you can not suppose it is true or false. But you can have a workaround : enable the GPIO pull down/up resistance
    If you want to return false when connect nothing ==> enable the GPIO pull down resistance
    If you want to return true when connect nothing  ==> enable the GPIO pull up resistance
I did a series of tests, and you are totally right. I wonder why I did not notice this earlier. Thanks a bunch!

With kind regards,
Frekvens1