Arduino analog read blocked after initialize hdmi

Hi,

I try to build a pet project to read from arduino analog pin and put or plot it on hdmi screen.

from pynq.overlays.base import BaseOverlay
from pynq.lib.arduino.arduino_analog import Arduino_Analog
from pynq.lib.video import *
from time import sleep

print("All libraries loaded")

ol = BaseOverlay('base.bit')
xadc =  Arduino_Analog(ol.ARDUINO,[1]) #A1

print("read from sensor 1")
value_from_sensor = xadc.read()
print(f"Values xadc: {value_from_sensor}")

frame_height = 600
frame_width = 800

base = BaseOverlay("base.bit")
hdmi_out = base.video.hdmi_out

Mode = VideoMode(frame_width, frame_height, 24, fps=60)
hdmi_out.configure(Mode,PIXEL_BGR)
hdmi_out.start()
sleep(2)

print("Hdmi out start.")
print(hdmi_out.mode)

y_offset =  200
img_in_array = np.zeros((frame_height, frame_width, 3), dtype=np.uint8)
img_in_array[y_offset, :] = (255, 255, 255)

frame = hdmi_out.newframe()
print("Hdmi out frame created.")

for x in range(0, frame_width):
    print("read from sensor")
    value_from_sensor = xadc.read() # always blocked
    print(f"Values xadc: {value_from_sensor}")
    
input("Step function completed. Press ENTER to exit.")
hdmi_out.stop()
hdmi_out.close()

I found if i load all thing related with hdmi xadc.read() will be blocked and never return value.
If I comment or remove all related with hdmi, xadc.read() will return a value.
My board : xilinx pynq-z2

Have i miss something in how to use this? Suggestion is highly appreciated.
Thanks in advance.

regards
sLawalata

Hi @slawalata,

Welcome to the PYNQ community.

You are downloading the overlay twice (`ol = BaseOverlay(‘base.bit’)`), the second time you run this, will clear any previous state. Remove the repeated line (second instance) and try again.

Mario