For the complete documentation index, see llms.txt. This page is also available as Markdown.

Examples

Use case

This example reads raw red, green, blue, clear, and proximity values from the CAN Color Sensor and publishes them to SmartDashboard. It also shows how to enable the onboard LED and safely normalize the color channels.

The snippets use CAN bus 2 and device ID 0. Change both values to match the controller and sensor configuration.

Mounting example

CAN Color Sensor mounted for target detection

Setup

Install the AndyMark WPILib vendor library before using these examples. LED control requires device firmware 1.1.1 or newer and AmLib 2026.0.2 or newer. See Device API for all available methods.

Validation steps

  1. Record raw values with no target present.

  2. Record each target at the actual operating distance and angle.

  3. Repeat with the robot’s normal illumination and surrounding structure installed.

  4. Test under practice and event lighting.

  5. Choose thresholds from measured separation between targets and include margin for noise.

Last updated

Was this helpful?