Pneumatics Problem

Hi guys,
My team just got pneumatics, and we have not idea how to use them. I’ve got really simple code on it right now:


if (vexRT[Btn7U]==1) {
     SensorValue(solenoid) =1;
}
else if (vexRT[Btn7D]) {
     SensorValue(solenoid) =0;
}

I’ve got the pneumatics system set up exactly how it is in some of the tutorials I’ve watched, and it’s still not working. I have the cylinder connected to the switch, then the switch connected to the solenoid port labeled “P”, and then 2 hoses connected to a double acting cylinder from ports “A” and “B”. And yes, “solenoid” is defined in my code as a digital out sensor and is connected to the right port.
Right now, air flows through the solenoid and keeps the piston retracted, but I don’t know how to make the piston expand again. Any help would be appreciated. Thanks.

Switch the “==” to “=”. The “==” is reading a value, the “=” is setting a value.

if (vexRT[Btn7U]==1) {
     SensorValue[solenoid] =1;
}
else if (vexRT[Btn7D]==1) {
     SensorValue[solenoid] =0;
}

No that’s just a typo in transferring over my code, that’s not in the real thing. Meaning it still doesn’t work.

So set up like this:
https://vexforum.com/index.php/attachment/57241f31e4ff3_680px-Pneumatics_Kit_2_Annotated.png
Sorry if I am seaming too basic, just trying to see the exact problem.

The problem is with your code. Surround “solenoid” with brackets [solenoid], instead of parentheses.

Hi again,
Thanks for your suggestions.
Unfortunately neither of those worked, and I ended up trying an old cortex with everything the same, and it worked. Does anybody know why? How could we fix it? This cortex is only like 6 months old, but the old one 3 years.

Did you try multiple ports on the new one, one could be bad.

Yeah I’ve tried 4 or so. The firmware is also up to date.

Could @jpearman shed some light on my situation?

Can you hear the solenoid clicking when you try and press the buttons? Is your code in a while loop?

No, and yes. I have the exact same code downloaded to the working cortex as the broken new one. I can hear the solenoid clicking on the working one, but not the new one.

So it sounds as if the cortex has an issue. I assume you have the main battery plugged in and turned on. Try checking the digital ports with an led if you have one, othwise it sounds like a call to vex support if it’s under warranty.

Ok, thanks. Problem is, we have a competition on Saturday. We need to get something worked out now, and we can’t use the old cortex because it has power issues.