0
votes

I am working on Adafruit FT232H with UBUNTU gateway. I need to control the GPIO pins one by one. I wrote a script in python to control the GPIO pins. But when I turn on GPIO pin 9, GPIO pin 8 turns off automatically which was previously turned ON unlike Raspberry Pi GPIO pins. As I knew, the state of previous pins should remains unchangeable until we explicitly change it from LOW to HIGH or vice versa. I have little knowledge on python and the Adafruit datasheet, so could you please suggest me what I done wrong in below code.

#!/usr/bin/python
import sys
import Adafruit_GPIO as GPIO
import Adafruit_GPIO.FT232H as FT232H
FT232H.use_FT232H()
ft232h = FT232H.FT232H()
chno = int(sys.argv[1]) #channel(8-15) number passed as argument
status = int(sys.argv[2]) #status(LOW/HIGH or 0/1) passed as argument
ft232h.setup(chno,GPIO.OUT)
if (status == 0):
      ft232h.output(chno, GPIO.LOW)
if (status == 1):
      ft232h.output(chno, GPIO.HIGH)
1
Maybe when you're starting the device, it sets all the outputs to 'low', so when you rerun the script, it'll reset the pins to the default value. I guess you should change the outputs without restarting your script. - tglaria
Thanks tglaria. But the problem is not that.For example, if pin 9 is set to HIGH by explicitly, that means I turned on LED 9 and now I want to turn on another LED pin 10, so I have to set pin 10 to HIGH explicitly but the problem is now, pin 9 is set to LOW automatically when I set pin 10 to high. Simply, for each execution, only .current states going to set and all previous states are reset to LOW implicitly. - Tata Rao
Well, how are you setting each pin? From the python interpretter? - tglaria
yes. Through python interpreter I am setting gpio pins - Tata Rao

1 Answers

0
votes

If you try with this code:

ft232h.setup(9,GPIO.OUT)
ft232h.setup(10,GPIO.OUT)
ft232h.output(9, GPIO.HIGH)
ft232h.output(10, GPIO.HIGH)

Do you have both pins high?

And with the following code?

ft232h.setup(9,GPIO.OUT)
ft232h.output(9, GPIO.HIGH)
ft232h.setup(10,GPIO.OUT)
ft232h.output(10, GPIO.HIGH)