We are trying to figure how to manage to have 2 pneumatics in our system. This code seems to work with 1 pneumatic in the code, but once we add the second pneumatic it doesn’t work. We have tried a new brain, new solenoid, new driver, everything, and it has fixed nothing. So the problem must be in the code.
#include "vex.h"
using namespace vex;
bool open=true;
void Clamp1()
{
open=!open;
}
bool open1=true;
void Clamp2()
{
open1=!open1;
}
int main() {
vexcodeInit();
digital_out pneumatic1 = digital_out(Brain.ThreeWirePort.A);
digital_out pneumatic = digital_out(Brain.ThreeWirePort.C);
Controller1.ButtonL1.pressed(Clamp1);
if (open==true)
{
pneumatic.set(true);
}
else {
pneumatic.set(false);
}
Controller1.ButtonR1.pressed(Clamp2);
if (open1==true)
{
pneumatic1.set(true);
}
else {
pneumatic1.set(false);
}
}
Any suggestions on how to fix this issue would be greatly appreciated.
edit: code tags fixed by mods.