My servo motor isnt moving when ir sensor senses something

I am trying to get the servo motor to turn 180 degrees and then back to 0 degrees when the IR sensor senses something Circuit. techleader

import time
from pyfirmata import Arduino, util

board = Arduino('COM5')

iterator = util.Iterator(board)

motor = board.get_pin('d:6:s')

sensorPinNo = 2

sensorPin = board.get_pin('d:' + str(sensorPinNo) + ':i')

print("Nothing is being sensed ")

rlt =
while True:
    if rlt:
        print("Sensor has detected something")

        def setServoAngle(angle):
            print("Wiping In Progress")
            for i in range(0, 180):
            for i in range(180, 1, -1):

        print("Program Exit")

I have: Arduino uno, servo motor, IR sensor, Buzzer, LED, Resistors, Breadboard, Jumper wires

Are you going to post the Arduino code ?

…all of it ..

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.