I have been using PROS for a while, love it because I’m used to C. But I have a slight issue with using pneumatics.
Whenever VexNET is disconnected, on disconnect all solenoids cycle once (on and off). Then while it’s searching for a signal they continue to cycle on a time period I have yet to measure. Same thing happens on first power on.
This causes issues with safety as my team often forgets to shut off the pneumatic system before doing anything and almost get things in their face. Not fun
Is this because by default all pins are set to floating input instead of an output and that is causing issues?
My code is below
void initializeIO() {
/**
* Set pin modes for solenoids
*/
pinMode(SOL_LEFT, OUTPUT);
pinMode(SOL_RIGHT, OUTPUT);
pinMode(SOL_FLIP, OUTPUT);
/**
* Assign default values to solenoids
*/
digitalWrite(SOL_LEFT, 0);
digitalWrite(SOL_RIGHT, 0);
digitalWrite(SOL_FLIP, 0);
}
Function I wrote to toggle the pins:
void toggleDigitalPort(unsigned port) {
digitalWrite(port, (digitalRead(port) == 1 ? 0 : 1));
}