Here is an example of a student project using the ZA6 and an infrared sensor. We are using a conveyor controlled in the robot program with a relay. The Conveyor is turning on and off via the infrared sensor.
def main():
set_digital_out(“Conveyor”, True)
while get_digital_in(“Distance_Sensor”) is False:
sync()
set_digital_out(“Conveyor”, False)
while get_digital_in(“Distance_Sensor”) is True:
sync()