Programming Pneumatics with PROS

Hey everyone,

I have been working on using pneumatics for our robot; it will only be used once in a match so it doesn’t have to be too complex!

I have been trying to use the tutorial found here: https://pros.cs.purdue.edu/cortex/tutorials/pneumatics.html

However, when I have been testing this, I am not able to activate the pneumatics using the button I programmed. I can’t seem to find any other tutorials using PROS, and I was wondering what I was doing wrong.

I will put the code below:

[code=“opcontrol.c”] /*
* Pneumatics Controls
*/
if(joystickGetDigital(1, 7, JOY_DOWN)) {
pneumaticMove();
}
else {
}



[code"pneumatic.c"]
#include "pneumatic.h"
#include "main.h"

void pneumaticMove()
{
  digitalWrite(1, LOW);
}

I have also initialized it in init.c


void initializeIO() {
  pinMode(1, OUTPUT); // configure digital port 1 as an output
  digitalWrite(1, LOW); // write LOW to port 1 (solenoid may be extended or not, depending on wiring)
}

I am not sure what I am doing wrong; I have never used pneumatics before.

Thanks so much for all of the help!

Pneumatics are a digital output - they’re extended when they receive 5V (HIGH) and retracted when they receive 0V (LOW). You’re just asking the kernel to set the pneumatics to


LOW

, so naturally, they won’t do anything. You’ll need to modify your code to alternate between HIGH and LOW, presumably whenever you press a button (like you have).

Ok, I will test it out! Thanks so much for the quick reply!