View Single Post
  #3   Spotlight this post!  
Unread 02-02-2008, 11:47
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: Sending data from RC to OI

This code is from the IFI code.

Code:
	if(user_display_mode == 0)
	{
		// update the "PWM 1" LED
    	if(p1_y >= 0 && p1_y <= 56)
    	{						// joystick is in full reverse position
      		Pwm1_green = 0;		// turn PWM1 green LED off
      		Pwm1_red = 1;		// turn PWM1 red LED on
		}
		else if(p1_y >= 125 && p1_y <= 129)
		{						// joystick is in neutral position
			Pwm1_green = 1;		// turn PWM1 green LED on
			Pwm1_red = 1;		// turn PWM1 red LED on
		}
		else if(p1_y >= 216 && p1_y <= 255)
		{						// joystick is in full forward position
			Pwm1_green = 1;		// turn PWM1 green LED on
			Pwm1_red = 0;		// turn PWM1 red LED off
		}
		else
		{						// in either forward or reverse position
			Pwm1_green = 0;		// turn PWM1 green LED off
			Pwm1_red = 0;		// turn PWM1 red LED off
		}

		// update the "PWM 2" LED
		if(p2_y >= 0 && p2_y <= 56)
		{						// joystick is in full reverse position
			Pwm2_green = 0;		// turn pwm2 green LED off
			Pwm2_red = 1;		// turn pwm2 red LED on
		}
		else if(p2_y >= 125 && p2_y <= 129)
		{						// joystick is in neutral position
			Pwm2_green = 1;		// turn PWM2 green LED on
			Pwm2_red = 1;		// turn PWM2 red LED on
		}
		else if(p2_y >= 216 && p2_y <= 255)
		{						// joystick is in full forward position
			Pwm2_green = 1;		// turn PWM2 green LED on
			Pwm2_red = 0;		// turn PWM2 red LED off
		}
		else
		{						// in either forward or reverse position
			Pwm2_green = 0;		// turn PWM2 green LED off
			Pwm2_red = 0;		// turn PWM2 red LED off
		}

		// update the "Relay 1" and "Relay 2" LEDs
		Relay1_green = relay1_fwd;	// LED is on when Relay 1 is FWD
		Relay1_red = relay1_rev;	// LED is on when Relay 1 is REV
		Relay2_green = relay2_fwd;	// LED is on when Relay 2 is FWD
		Relay2_red = relay2_rev;	// LED is on when Relay 2 is REV

		// update the "Switch 1", "Switch 2" and "Switch 3" LEDs
		Switch1_LED = !(int)rc_dig_in01;
		Switch2_LED = !(int)rc_dig_in02;
		Switch3_LED = !(int)rc_dig_in03;
	}
  	else  /* User Mode is On - displays data in OI 4-digit display*/
	{
		User_Mode_byte = backup_voltage * 10;
	}
__________________
Eric Haskins KC9JVH