Pneumatics help

This year my team has deiced to use pneumatics, we under stand how to set it up but have not been able to get our code to work. We are very lost with how to code them, can some please help. thank you

In RobotC: the solenoid gets plugged into a digital port and gets set up as a digital out. It is then coded where a value of 1 activates the solenoid and 0 deactivates the solenoid. Here is an example

#pragma config(Sensor, dgtl2,  pneumatic,            sensorDigitalOut)

task main()
{
  while(true)                    
  {
    if(vexRT[Bt7U] == true)         
    {
      SensorValue[pneumatic] = 1;  
    }
    else                          
    {
      SensorValue[pneumatic] = 0;  
    }
  }
}

I have already tried using this code and have followed youtube tutorials add have still not been able to get the pneumatics to work.

Potentially the software is working then, and the problem lies with the hardware. Solenoid valves don’t shift unless there is enough air to pilot them. Double check the guide papers that came with your kit, and review the attached document, just be sure things are connected together correctly.
pneumatics information.pdf (313 KB)

I would suggest changing the port in the cortex and making sure there is enough air along with no leaks. The code I put worked 100% of the time when there was a good connection, no leaks, and enough air.

When I first started using pneumatics, I was trying to learn it while using a brand new, but defective solenoid driver cable. If the code that Josh posted doesn’t work, and you are sure you have it set up as digital out and in the correct port, try another driver cable. If somebody had told me this when I started learning, it would’ve saved me a week :wink: