Detección de colores#
This tutorial walks you through using the Eye Sensor to detect a color, using a Green Disk as an example. By the end, you’ll have a project that prints a message once green is detected.
Make sure your robot has an Eye Sensor connected. See Configuring Devices if you haven’t added one yet.
Attach a set eye light block below the when started block. This helps the Eye Sensor detect colors more clearly.
cuando inicie :: hat events
establecer luz del sensor [encendido v]
Attach a wait until block below it.
cuando inicie :: hat events
establecer luz del sensor [encendido v]
esperar hasta <>
Drag the Eye Sensor’s eye detects color Boolean block into the wait until block’s condition slot.
cuando inicie :: hat events
establecer luz del sensor [encendido v]
esperar hasta <¿sensor detecta [rojo v]?>
Change the color parameter to green.
Attach a print block below the wait until block.
cuando inicie :: hat events
establecer luz del sensor [encendido v]
esperar hasta <¿sensor detecta [verde v]?>
imprimir [VEXcode] ▶
Change its text to Green detected!.
Make sure your robot is connected to VEXcode. See Connecting to Your Robot if it isn’t connected yet.
Select Start to run the project.
Hold a Green Disk in front of the Eye Sensor. Once it’s detected, Green detected! will print to the Console.