'cvzone WARNING:root:Serial Device Not Connected

I'm trying to use the cvzone module to connect my python file to arduino but i cant seem to connect to my port "COM3" even though i made sure that it's turned on (arduino shows Port: "COM3")

from cvzone.SerialModule import SerialObject 
import time

arduino = SerialObject("COM3") #input arduino port number

while True:
    arduino.sendData([1]) #Send signals [1] means "turn on"
    time.sleep(1)
    arduino.sendData([0])
    time.sleep(1)

When I run the program, nothing happens and it shows:

WARNING:root:Serial Device Not Connected



Solution 1:[1]

I was facing the same issue but when I put my COM port number it working fine. Here is my code:

import cv2
from cvzone.FaceDetectionModule import FaceDetector
from cvzone.SerialModule import SerialObject

cap = cv2.VideoCapture(0)
detector = FaceDetector()
arduino = SerialObject("COM5")
while True:
    success , img = cap.read()
    img,bboxs = detector.findFaces(img)

    if bboxs:
        arduino.sendData([1])
    else:
        arduino.sendData([0])

    cv2.imshow("Image",img)
    if cv2.waitKey(10) == ord("q"):
        break

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tahir habib