Quote:
Originally Posted by rocketperson44
One more question: How would I control a relay using a joystick? I want it so that, when the joystick is pushed 50% in either direction, the relay turns on accordingly, but I cannot find a direct way to operate a relay with a joystick.
|
Code:
#include "Main.h"
void OperatorControl ( void )
{
unsigned char temp;
temp = GetOIAInput ( 1 , 1 ) ;
if ( temp > 192 )
{
SetRelay ( 1 , 1 , 0 ) ;
}
else if ( temp < 64 )
{
SetRelay ( 1 , 0 , 1 ) ;
}
else
{
SetRelay ( 1 , 0 , 0 ) ;
}
}