Getting additional GPIO ports

So I wanted to share an extension our team put together last year to allow us to have more GPIO ports without adding another digital module + sidecar.

We built 2 methods, one utilizing a simple MUX chip. Another utilizing a standard I2C based GPIO chip. We utilized the I2C based one on our robot and it worked pretty well.

The MUX chip uses 5 DIO’s from the sidecar to get you 16 on the mux. Additionally there is lag time to read each pin so it’s overall a slow and cumbersome implementation. But we tested it out and included it for reference.

The I2C version is fairly smart, retrieves every pin value once per DriverStation packet, so only the first pin-get on the board makes an actual call to the board and gets all values at once, subsequent calls in the same frame will retrieve the cached values from the first call(unless forced).

There are notes about the classes within the files, including which boards/chips were tested. One note, on the DFRobot I2C board, we had the best luck if we did actually supply 5V power to the power terminals on the board. Without that we had intermittent issues with the board.

Files are attached. If you have any questions or comments, please post them :slight_smile: