In case anyone needed some help with putting on an automated air compressor, here is some code that may be able to help. In order to use this, you would need a single pressure switch attached to a relay and an input, and a relay for the air compressor.
In Initialize:
Code:
InitPressureSwitch(psInput, psRelay);
And in a new function:
Code:
void PressureSwitch(void)
{
unsigned char pswitch;
pswitch = GetDigitalInput(psInput);
if (pswitch)
{
SetRelay(airpump, 1, 0);
}
else
{
SetRelay(airpump, 0, 0);
}
}
You also need to appropriately set the values of airpump, psInput, and psRelay.
__________________
Team #2970 Alum
Team #1652 Alum
2006: School Mascot for Team 1652
2007-2008: Programmer for Team 1652 (Robot Mafia)
2009: Programmer on Team 1652 (Robot Mafia), Programmer on Team 2970 (eSchool eBots)
2010-2016: Volunteer, Wisconsin Regional
2017: Programming Mentor, FRC 4247 (CougarBOTS, Obama SCTE, Milwaukee, WI)