|
Re: Programming the Pressure Sensor
This is the section from our Begin.vi involving the compressor. Note that the "Open" block is in a case structure; this allows us to have two sets of IO for our practice and competition robots, and is not required in your setup. We open the compressor and set it's sensor and relay ports, then start it, then set it to a refnum. We don't need it anywhere but here, except to close the compressor in Finish.vi. Once we call "Start", the compressor sets up an interrupt on the pressure switch port and switches the Spike for the compressor on change. You need to do nothing to handle the compressor or pressure switch at all. If you need the status of the pressure switch, then you can use the Compressor Get Refnum to get the refnum and a Get Enabled State to check if the compressor is enabled and if it is on.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor
"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
|