3-Wire Expander API in PROS

For my team’s latest robot, we are using a 3-wire expander in order to use tracking wheels and line sensors. In PROS, as far as I can tell, the expander is not officially supported.

I found this api on github and based on the comments and my reading of the changelog it seems like it should work. However, looking at the files to commit, I noticed a lot of them belong to a directory called ‘devices’ within ‘src’. ie: src/devices/vdml_adi.c.

In my PROS projects, the src folder only contains main.cpp. Am I supposed to create new directories or am I missing something?

Thanks.

It is supported, at least in the C API. ADI devices, or at least some of them, support passing a SmartPort parameter, where 0 is the built in ADI ports and 1-21 are smart ports.

1 Like

Do you know if support exists in C++? I don’t see anything about it in the documentation.

I dont think so, but you can use the c api, or indirectly access things using Okapilib if they are implemented.

The ADI Expander is supported. Documentation for it is available in the PROS docs.

In the latest PROS kernels (since 3.3.0 I believe?) all ADI devices have two constructors in the C++ API, one that takes one port as an argument and which references the built in ADI, ex:

#define GYRO_PORT 1

void opcontrol() {
  pros::ADIGyro gyro (GYRO_PORT);

As well as one that takes a tuple as an argument, with one value being the smart port of the ADI expander, and the other being the ADI port on the expander, ex.

#define ADI_GYRO_PORT 'a'
#define SMART_PORT 1

void opcontrol() {
  pros::ADIGyro gyro ({{ SMART_PORT , ADI_GYRO_PORT }});

This is documented in the official PROS C++ ADI API, which can be found here:
https://pros.cs.purdue.edu/v5/api/cpp/adi.html
@dashwsd and @Drew2158U I suggest that you read through through the official docs first in the future when you have any questions about what the PROS API does or does not support.

11 Likes

^^^^^^ this is the correct answer.

I can’t believe I missed this, thank you!