Lesson Overview
You will explore how an automated system can identify and sort objects using sensor input. This example uses the optical sensor hue value to decide where the robotic arm should place the object.
Use sensor input or programmed logic to identify and sort objects based on color or another visible property.
You will explore how an automated system can identify and sort objects using sensor input. This example uses the optical sensor hue value to decide where the robotic arm should place the object.
Review the code, copy it when needed, and add comments before submitting your final version.
arm10.move_to(180, 100, 100)
arm10.set_end_effector_type(Arm.MAGNET)
arm10.move_to(100, 200, 20)
arm10.set_end_effector_magnet(True)
arm10.move_to(100, 200, 75)
arm10.move_to(45, 175, 50)
optical_5.set_light(LedStateType.ON)
optical_5.set_light_power(50, PERCENT)
wait(1, SECONDS)
if optical_5.hue() > 50:
arm10.move_to(175, 0, 100)
arm10.move_to(175, 0, 30)
arm10.set_end_effector_magnet(False)
elif optical_5.hue() < 50:
arm10.move_to(175, 150, 100)
arm10.move_to(175, 150, 30)
arm10.set_end_effector_magnet(False)
else:
arm10.set_control_stop(True)
signal_tower_6.set_color(SignalTower.BLUE, SignalTower.BLINK)