Rev's Color Sensor v3

I’m a new programmer for our team. I am trying to get the color sensor to work. I’ve plugged it in, light is on. How do I get it to show the “feed” as shown in the rev robotics video? I copied and pasted the entire code from the provided Github link.
I am using the 2019 robot code, created a new file.

You will need to have the correct libraries installed, found here
I would also recommend you create a project from WPILib, then in the robot.java file from the same Github repo you linked, there is relevant code to use it.

i’ll be honest, i’m not seeing the libraries

It is a bit lower on the link @AndrewMcb provided

2 Likes

how to open json file? Can i just upload it to VSC?

From WPILib 3rd Party Libraries

Adding an Offline-Installed Library

../../../_images/adding-offline-library.png

To add a vendor library that has been installed by an offline installer, press Ctrl+Shift+P and type WPILib or click on the WPILib icon in the top right to open the WPILib Command Palette and begin typing Manage Vendor Libraries , then select it from the menu. Select the option to Install new libraries (offline) .

../../../_images/library-installer-steptwo.png

Select the desired libraries to add to the project by checking the box next to each, then click OK. The JSON file will be copied to the vendordeps folder in the project, adding the library as a dependency to the project.

Checking for Updates (Offline)

Remember: Dependencies are now version managed and done on a per-project bases. Even if you have installed an updated library using an offline installer, you will need to Manage Vendor Libraries and select Check for updates (offline) for each project you wish to update.

Checking for Updates (Online)

Part of the JSON file that vendors may optionally populate is an online update location. If a library has an appropriate location specified, running Check for updates (online) will check if a newer version of the library is available from the remote location.

3 Likes

I downloaded the library for the REV color sensor v3 from the link above, but when I click on manage vendor libraries and then Install New Libraries (offline), it doesn’t come up as an option, just “WPILib-Old-Commands”

How do I get it to be an option?

Drag and drop this REVColorSensorV3.json (1.1 KB) into your vendordeps folder. Then it should detect that you have added a vendordep to your project and should build. Otherwise run the build command in VSCode.

2 Likes

oh thanks that worked perfectly!

do I still need to press Install new library in vs code? or should it be fine just dropping it in folder?

EDIT: Nevermind I got it to work fine -thank you everyone

What did you use to display/read the values? I’m stuck on that part!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.