Controlling GPIOs with python
Posted: Wed Apr 05, 2023 8:26 pm
EDIT: Works correctly now with no change in code.
Hello,
I am trying to follow the tutorials to control GPIO pins through python. The tutorial to control the slow analog I/Os, function generator and oscilloscope have worked correctly and I was able to make changes to the code to use it in other ways.
The GPIOs do not seem to be responding correctly when I use the following code.
############### - start code
from redpitaya.overlay.mercury import mercury as FPGA
overlay = FPGA()
GPIO = FPGA.gpio
gpio_o = GPIO('n', 7, "out")
gpio_o.write(False)
gpio_i = GPIO('n', 7, "in")
gpio_i.read()
############## - end code
The output for this code is ' True ' Even though I am writing False to that pin. I measure the voltage on the pin w.r.t ground using a multimeter and see no read 0V no matter what I write to the pin.
Am I making a programming mistake here, or could it be that the board is faulty?
Thanks,
Ansh
Hello,
I am trying to follow the tutorials to control GPIO pins through python. The tutorial to control the slow analog I/Os, function generator and oscilloscope have worked correctly and I was able to make changes to the code to use it in other ways.
The GPIOs do not seem to be responding correctly when I use the following code.
############### - start code
from redpitaya.overlay.mercury import mercury as FPGA
overlay = FPGA()
GPIO = FPGA.gpio
gpio_o = GPIO('n', 7, "out")
gpio_o.write(False)
gpio_i = GPIO('n', 7, "in")
gpio_i.read()
############## - end code
The output for this code is ' True ' Even though I am writing False to that pin. I measure the voltage on the pin w.r.t ground using a multimeter and see no read 0V no matter what I write to the pin.
Am I making a programming mistake here, or could it be that the board is faulty?
Thanks,
Ansh