# REV Color Sensor V3

This sensor is emits light and then analyzes the reflected light that it sees. It is capable of measuring:

* raw distance up to 10cm (but most effective under 2cm)
* Alpha&#x20;
* Hue&#x20;
* Red&#x20;
* Blue&#x20;
* Green

&#x20;

Full Guide from REV Robotics: <https://docs.revrobotics.com/color-sensor/>&#x20;

Color Sensor Class Documentation: <http://ftctechnh.github.io/ftc_app/doc/javadoc/index.html>

Distance Sensor Class Documentation: <http://ftctechnh.github.io/ftc_app/doc/javadoc/index.html>&#x20;

Supporting Images:

<figure><img src="/files/KfJz6rDubvw1rrnfSY6E" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/M1IQacsIyQ3Cu4cQl2zn" alt=""><figcaption></figcaption></figure>

### Useful code:

Add your sensor object with the rest of your robot objects:

<figure><img src="/files/t74Lv3y05KZDx8KBdHwu" alt=""><figcaption></figcaption></figure>

Hardware map it!:

<figure><img src="/files/Fms3GJ3DLU4apv7qcgMS" alt=""><figcaption></figcaption></figure>

Add some code like this to your main loop to read the values on your sensor:

<figure><img src="/files/tOEmqsVgfZq0qz0B5yW0" alt=""><figcaption></figcaption></figure>

Try something like this to drive until your sensor sees a red line:

```
while( color.red() < 100){
    backLeft.setPower(.5);
    backRight.setPower(.5);
    frontLeft.setPower(.5);
    frontRight.setPower(.5);
}
backLeft.setPower(0);
backRight.setPower(0);
frontLeft.setPower(0);
frontRight.setPower(0);
```

\*Note, this code is not intended to work right off the bat… this is just an idea of how you could use a color sensor to control your robot!\*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guides.mccaskeyrobotics.org/ftc/sensors/rev-color-sensor-v3.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
