View Single Post
  #6   Spotlight this post!  
Unread 18-02-2008, 01:58
Stvn's Avatar
Stvn Stvn is offline
FIRST Competition Competer
AKA: Steven Rhodes
FRC #0100 (WHS/CHS - WildHats)
Team Role: Leadership
 
Join Date: Feb 2007
Rookie Year: 2004
Location: Woodside, CA
Posts: 90
Stvn is an unknown quantity at this point
Send a message via AIM to Stvn
Re: Connecting IR Board

As an alternative way to power the board, you could connect the power and ground wires to an unused PWM output. The 7.2 volts from that is enough for its operation.

Here's the code we're currently using to get the inputs (using WPILib):
Code:
unsigned char Previous_Value;

int GetIR (void) {
	unsigned char IR_Value;

	IR_Value=GetDigitalInput(IR_1)+(GetDigitalInput(IR_2)*2)+(GetDigitalInput(IR_3)*3)+(GetDigitalInput(IR_4)*4);
	if(IR_Value>0) {
		Time=0;
		Previous_Value = IR_Value;
		return IR_Value;
	} else if(Time>250) {
		Time = 0;
		Previous_Value = 0;
		return 0;
	}else if(IR_Value==0) {
		++Time;
		return Previous_Value;
	}
}
__________________