Our team would like to use an ultrasonic rangefinder that uses the signal pin for both input and output (ping control and echo are on the same data line).
How would you go about using WPILib to switch a GPIO pin between input and output? Specifically, I'd like to do something along the following lines:
Code:
DigitalOutput ping(12);
Counter echo(12);
echo.SetSemiPeriodMode(true);
/* ... */
ping.Pulse(pingPulseWidth);
double range = echo.GetPeriod();
This is very easy to do with most microcontrollers, but I can't see an easy way to do this with WPILib. Any tips from the WPI guys?