I'm working on tensorflow lite project with custom models. I'm making a conveyor belt to detect and remove defective items which are trained by me. My camera detects object but when it comes to make servo work when object is in front of IR sensor it fails. below is code: '''

Read the state of the IR sensor

ir_sensor_state = GPIO.input(ir1)

# Check if a defective object is detected by the camera
if defective_detected:
    # Perform your desired actions when the object is in front of the IR sensor
    if ir_sensor_state == GPIO.LOW:
        servo.angle = 25
        servo.angle = -90

    # No defective object detected, so don't perform any actions
    servo.angle = -90
  • How does it fail? Is there an error message?
    – CoderMike
    Commented Mar 11 at 15:42
  • There's isn't any error! my program detects defective object by camera but later i want to move it using servo when ir detects it.
    – namaaa
    Commented Mar 12 at 3:26
  • and what happens with the servo? ... i want to move it using servo is not a description of what happens
    – jsotola
    Commented Mar 12 at 6:40


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.