VEX U - Programming PIXY using Arduino

My team is mostly all Freshman in college and we’re trying to incorporate PIXY into our design as a custom sensor using Arduino. Does anyone by any chance have any sample code for using PIXY or know anyone that could possibly send us some code to work with. Just getting started is all we need. Thanks for your time!

Check out this page to start with.

You can download a zip that contains the library and sample code.

Thank you!

Cool. Are you looking to automate reacting to elements on the floor or in the air too? Good use of a co-processor!

Like the badminton robot?

Or the ping pong playing robot?

I think Xander (one of our robotc developers) was planing to write a driver for the PIXY, I was also going to look into doing that at some point but, as it has been sitting here for the last 18 months or so powered off, don’t hold your breath. Perhaps we will get something together by the end of summer if you haven’t got it working by then.

I think the OP was planning on connecting the pixy to an arduino.

Unless he is using one of the weird arduino models like a due or a pc duino a cortex is still the more powerful microcontroller.

BNS used a Pixy last season, and wrote a library to interface it directly with the Cortex via UART. I understand that may not be what @TALONS is looking for, but in case anyone else is interested, we are now working on cleaning up the library and hope to release it.

Let the PIXY do the heavy lifting (ie. image processing). PIXY will give you simple object position and size over a serial connection. For more complex algorithms the PIXY code is open source so I would just change the PIXY code. There’s not much point having an arduino as in intermediate processor.

So the Pixy returns the X/Y position relative to the camera field of view along with the size of it.

How can you ascertain the distance the object might be from you? And how can you tell the velocity of said object? You have a plane view of it which may be coming directly at you making the x/y position not change much. For a sphere it may be easy, but these spiky things are tough.

O ya it doesn’t make sense but it was what the OP asked. I just thought maybe he wanted to do just about everything in arduino. Arduino could be useful for some stuff and if you wanted to program in an environment that you were used to just with stupid amounts of power.

I just ordered a PIXY and servo pan/tilt kit, so hopefully I’ll be able to start incorporating that into some autonomous scripts soon. Thank you for your Q/A post about the pan/tilt servos by the way, @TALONS , as I wasn’t aware of the legality of using non-vex motors on third-party sensors.

@LegoMindstormsmaniac is the library built on PIXY’s arduino library, or is it meant to be used in conjunction with it? I’m curious as to whether it is meant to aid in communicating with the cortex and interpreting the input, or if it is a set of functions that utilize that data. Either way, I’m definitely excited to test it out and grateful that you plan to release it to the public.

Connecting it directly to the cortex would be ideal actually. Would save on the UART between the cortex and the arduino. Please let me know when you are planning to release this. Would love to get into contact with you soon. As far as we’ve gotten is the libraries with arduino and none of us have any experience or background in programming so that would be a huge help! Thank you

Sorry for resurrecting this old post but I’ve been wondering if you or somebody else in BNS ever released that Pixy-to-Cortex library. Thanks.