I tried to connect two raspberry pi by their GPIO pins, using one as input, another one as output. This is how I connected them:

I simply connect two Raspberry Pi's GPIO Pin 9 with a 10K resistor.
I am using python to test the connection, the problem is the input side can not get the correct input, does anyone know why?
The python code for input side(on python console):
Code: Select all
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(9, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.input(9)
The python code for output side(on python console):
Code: Select all
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(9, GPIO.OUT, initial=GPIO.LOW)
GPIO.output(9, GPIO.HIGH)
The problem is when I set the pull_up_down parameter in input side to GPIO.PUD_DOWN, no matter how I change the output pin, the input always get 0. If I change the pull_up_down parameter to GPIO.PUD_OFF, the input is floating. It seems the input GPIO pin can not get any input from the output pin side, is there anything wrong with my connecting or my code?
Thank you!