View Single Post
  #5   Spotlight this post!  
Unread 11-03-2008, 19:09
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: A few basic EasyC Pro questions

Quote:
Originally Posted by rocketperson44 View Post
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 ) ;
      }
}
__________________
Eric Haskins KC9JVH