Pneumatics not working

Hello forumers!
Today I tested out the pneumatics that we are going to use with our wings this season, and it didn’t work/worked weird.

I pumped up the tank, set up the solenoid and all that. When I tried to use my code to turn it on and off, it wouldn’t work for some reason. I decided to troubleshoot it by making a fresh blank code file, and just toggling it to true and it worked perfectly fine. However, putting it in an if pressing loop, it wouldn’t do anything. I tried it in my competition code again, and just put a DigitalOutA.set(true); in my driver control while loop and that didn’t do anything at all.

I can’t send a picture of my setup right now, but does anyone have an idea of what my issue could be?

Thanks!
- Henry 344E

Its got to be your code not making it work can I see it?

Here is my code

// Include the V5 Library
#include "vex.h"

// Allows for easier use of the VEX Library
using namespace vex;

// Begin project code

// All variable setup
bool XPressing;
bool L1Pressing;
bool R1Pressing;

void preAutonomous(void) {
// PRE AUTON
  // make sure wings start retracted
  // motor setups
  Drivetrain.setDriveVelocity(200, rpm);
  Drivetrain.setTurnVelocity(75, rpm);
  Intake.setVelocity(200, rpm);
  // sensor setups
  DrivetrainInertial.calibrate();
  // Screen Printing
  Brain.Screen.setFont(prop60);
  Brain.Screen.setCursor(20, 4);
  Brain.Screen.print("344E");
  Brain.Screen.setFont(prop30);
  Brain.Screen.setCursor(5, 9);
  Brain.Screen.print("Thunder Chickens");
  Controller1.Screen.setCursor(5, 2);
  Controller1.Screen.print("344E");

  wait(1, seconds);
} 

void autonomous(void) {
// AUTON
  DrivetrainInertial.calibrate();
  wait(2, seconds);
  Drivetrain.driveFor(forward, 12, inches);
  Drivetrain.turnFor(left, 180, degrees);
  Drivetrain.driveFor(forward, 12, inches);
}

void userControl(void) {
  // DRIVER CONTROL

// All controls stay inside while loop
  while (true) {

LeftWing.set(true);
  }
}
int main() {
  // create competition instance
  competition Competition;

  // Set up callbacks for autonomous and driver control periods.
  Competition.autonomous(autonomous);
  Competition.drivercontrol(userControl);

  // Run the pre-autonomous function.
  preAutonomous();

  // Prevent main from exiting with an infinite loop.
  while (true) {
    wait(100, msec);
  }
}

This sounds like it could be a software problem with your code, but if it’s not, I’ve had similar issues before just caused by a broken solenoid - try testing your solenoid mechanically by pressing the blue button on it, this should manually activate it. If that doesn’t work, replace your solenoid. It could also be a problem with your wire - if the above doesn’t help, try replacing it.

It looks like your code is missing a wait inside the infinite loop in the userControl function. Always make sure to have a wait inside of loops which will never end because otherwise it will mess up the task scheduler and will break stuff. There’s also no point running the loop that fast in the driver control loop because you can only get input from sensors and output to motors/pneumatics every ~20 milliseconds. Here’s a version of that part of your code with the wait added:

while (true) {
    LeftWing.set(true);
    wait(20, msec);
}

Other then that I don’t see anything which would cause the pneumatics to not work, so if it still doesn’t work make sure it is configured properly in the device manager and there isn’t any physical problem.

One last thing, this isn’t related to the pneumatics not working but I would recommend calibrating the inertial sensor in the preAutonomous function instead of autonomous, because then your auto program can start as soon as it is enabled instead of having to wait for the inertial to calibrate

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.