Trying to get Pixy2 to work with Vscode java

Hi, im with team 7485 for FIRST robotics, we are trying to get a Pixy2 set up but when we try to import the github files at the top of each file it wont let us import them, the error says “the import io cannot be resolved”

Just want to start with the basics here. Have you installed the API for the pixy2? If not, here is a link with instructions on how to do this: https://github.com/PseudoResonance/Pixy2JavaAPI

Additionally, this may help: https://andymark-weblinc.netdna-ssl.com/media/W1siZiIsIjIwMTkvMDcvMTIvMTQvMjUvNDgvOTc0MGNkOGItMmRlOS00Mjc4LWFlYzEtMmY0ZGUyMGI1Y2NhL1BpeHlDYW0gU1BJIEluc3RydWN0aW9ucy5wZGYiXV0/PixyCam%20SPI%20Instructions.pdf?sha=e16096fe11ed8b61

I have followed the instructions to install the API into the repository and dependencies

Also we are using the pixy through the I2C port as there has been some bugs we were notified of when the Pixy is used with the SPI port

Does code still compile, or does build/deploy fail? If it still builds despite that error, then it’s just the java intellisense not working

it just fails as it cant get past the red errors when trying to import the github file

I’m not sure what this means… Can you share a link to your code? Preferably via github or similar

im trying to get a link now, but during that time ill try to explain

import io.github.pseudoresonance.pixy2api.Pixy2;
import io.github.pseudoresonance.pixy2api.Pixy2.Checksum;
we are trying to get these two files into the file we need them in so that we can use the libraries inside them

https://drive.google.com/drive/folders/1UX2N7ePFxFFiFe342x8M1Jo9L1VNk0Hq?usp=sharing

ahhhh okay, didn’t realize the package namespace was io.github. That makes much more sense now, thank you.

You say you followed the directions in the project readme (linked above), correct? Did you build code after adding the dependency to your build.gradle file? If you didn’t, AND you connected to robot wifi (aka no longer connected to the internet), then the dependency would not be found and you’d experience the symptoms you’re describing.

This link is private, so I can’t see it. Having said that, PLEASE tell me you’re not using google drive as source control… I know some teams do, but it’s very much not intended for that purpose. Please consider learning/using git and hosting your code in github/bitbucket/gitlab/etc) instead

we arent, but we dont have github set up either, we are ending practice in 5 minutes so i was trying to get a link quick. i know how to use git but for some reason our team doesnt want to put it there and we just have our local files on our computer

nope, haven’t connected to the robot and I did build the code after I put it in the gradle file and its still having the error

Okay, fair enough. Please urge them to reconsider, even if it’s just “commit once at the end of every meeting”. It WILL save you at some point.

I totally agree, ive been trying to convince them for a while now

I might just get one set up anyway so they can see the usefulness, but anyway the issue is still there

you should be able to see that code now, i wont be able to do more testing until tomorrow. right now the pixy code that is in there is copied from the github examples but it still wont read the imports

ok i fixed that issue, was just one number off in our build gradle, now we are trying to code the actual pixy into the code, do you have any idea how to do that using the I2C port? I only know how to do it using the SPI port

I’d honestly recommend using SPI. I2C has some serious issues that could cause the rio to crash hard randomly

Normally we would, but we were just at competition, and a recent bug (since 2021) has been found with the SPI port and gyroscopes and color sensors that slow the Rios speed down.