0
I am making a program that detects colors and shapes of objects with a camera, when being recognized the format and the color configured, the program makes the control of the GPIOS in which I connected a module relay. The problem I’m having is that when I use the time.Sleep command to keep the relay module on, the same causes the entire program to freeze.
Here’s the bit I’m trying to figure out:
if len(approx) == 4:
gpio.output(40 , 0)
time.sleep(10)
gpio.output(40, 1)
time.sleep(5)
cv2.putText(frame, "QUADRADO", (x, y), font, 1, (0, 255, 255) )
I am using opencv and all control is done by a Raspberry Pi 3 B+.
Thank you for your attention, friends.
Official documentation states that the Sleep function():
Suspend execution of the current thread for the given number of seconds.
Then you will have to use the multi threading... to use the Sleep function. Or when a microcontroller does not have multi threading, what is used is whethertempo_agora - tempo_inicio/referência == tempo_desejado
, then perform such command.– danieltakeshi