You can find code examples for various robot hardware components in the "WPI Robotics Library Users Guide". Look for Pneumatics in the T-O-C. It gives an overview of the Compressor and Solenoid objects.
This document is available at the FIRST Forge site, WPI project documents section. The link is:
http://firstforge.wpi.edu/sf/docman/..._documentation
Good luck!