Go to Post I mean who does want to write their code like this... [CODE] CANHAZ.VICTOR; GIMME.VICTOR; VROOMVROOM.VICTOR(1); KTHNXBAI; [CODE] - JohnFogarty [more]
Home
Go Back   Chief Delphi > Technical > Electrical
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 28-01-2008, 18:08
chattycat14's Avatar
chattycat14 chattycat14 is offline
Registered User
AKA: Jessica
FRC #1228 (Rahway Highschool Indians)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Rahway
Posts: 8
chattycat14 is an unknown quantity at this point
Send a message via AIM to chattycat14
Re: Wiring the IR Receiver

We're having a problem, we get a response from the IR board saying that the digital input has a value of 1 when it should be a 0. What should we do?
__________________
<3 Jess
  #17   Spotlight this post!  
Unread 28-01-2008, 18:32
ham90mack's Avatar
ham90mack ham90mack is offline
President of RIT FIRST
FRC #0073 (The Illumination)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Rochester, NY
Posts: 120
ham90mack is just really niceham90mack is just really niceham90mack is just really niceham90mack is just really niceham90mack is just really nice
Re: Wiring the IR Receiver

Make sure you are using either the 12 volt robot battery or the digital input power pins (which use the robot battery), otherwise the signal is not being grounded properly.
__________________
Old stuff:

FRC 2007 Strategy Solver. Version: 2.55. Progress: done.
  #18   Spotlight this post!  
Unread 28-01-2008, 18:37
chattycat14's Avatar
chattycat14 chattycat14 is offline
Registered User
AKA: Jessica
FRC #1228 (Rahway Highschool Indians)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Rahway
Posts: 8
chattycat14 is an unknown quantity at this point
Send a message via AIM to chattycat14
Re: Wiring the IR Receiver

Quote:
Originally Posted by ham90mack View Post
Make sure you are using either the 12 volt robot battery or the digital input power pins (which use the robot battery), otherwise the signal is not being grounded properly.
Under the online window it changes from 0 to 1 when the button is pressed, but when the actual program is downloaded it retains the value of 1.
__________________
<3 Jess
  #19   Spotlight this post!  
Unread 28-01-2008, 22:09
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Wiring the IR Receiver

Quote:
Originally Posted by chattycat14 View Post
Under the online window it changes from 0 to 1 when the button is pressed, but when the actual program is downloaded it retains the value of 1.
Online window??? Anyway, here is the code we're using. It has some safety built in, and shows the state on the OI.

Code:
//Variables should be declared at the beginning at the program
int mode = 0; //Set it to zero so the robot won't move!
int modea;
int irerror;
int errorloop;



//Switches off all the LEDs on the OI
Switch1_LED = 0;
Switch2_LED = 0;
Switch3_LED = 0;
Relay1_red = 0;
Relay2_red = 0;
Relay1_green = 0;
Relay2_green = 0;
Pwm1_green = 0;
Pwm2_green = 0;
Pwm1_red = 0;
Pwm2_red = 0;
/*The following code will check to make sure the IR sensor is not malfunctioning, 
or it is not disconnected, as no more than one button can be triggered at a time.*/
mode = 0; //If there is no signal from the IR board later in the code, then disable the robot
irerror = 1;
if ((rc_dig_in03 + rc_dig_in04 + rc_dig_in05 + rc_dig_in06) < 3) 
{ 
	irerror = 0; //Tells the disable program that there is no error detected
	if (rc_dig_in03 == 1)
	{
		modea = 1;	//Set to Mode 1 (1st button)
	}
	if (rc_dig_in04 == 1)
	{
		modea = 2;	//Set to Mode 2 (2nd button)
	}
	if (rc_dig_in05 == 1)
	{
		modea = 3;	//Set to Mode 3 (3rd button)
	}
	if (rc_dig_in06 == 1)
	{
		modea = 0;	//EMERGENCY STOP (4th button)
	}
	mode = modea;
}
//The following are the certain autonomous programs
//Each mode acts like a different program.  

if (mode == 1) //Mode 1
{
	printf("Mode 1 %d\r");
	Switch1_LED = 1;
//Put your custom programming here, this will execute when the first button is pressed			
}




if (mode == 2) //Mode 2
{
	printf("Mode 2 %d\r");
	Switch2_LED = 1;
//Put your custom programming here, this will execute when the second button is pressed
}





if (mode == 3) //Mode 3
{
	printf("Mode 3 %d\r");
	Switch3_LED = 1;
//Put your custom programming here, this will execute when the third button is pressed
}

 


//Leave the following code at the very end of the autonomous cycle, so it is sure to execute when and if it is needed.
if (mode == 0) //EMERGENCY STOP
{
	printf("Mode: Disabled %d\r");
	pwm01 = pwm02 = pwm03 = pwm04 = pwm05 = pwm06 = pwm07 = pwm08 = 127;
  	pwm09 = pwm10 = pwm11 = pwm12 = pwm13 = pwm14 = pwm15 = pwm16 = 127;
	relay1_fwd = relay1_rev = relay2_fwd = relay2_rev = 0;
	relay3_fwd = relay3_rev = relay4_fwd = relay4_rev = 0;
	relay5_fwd = relay5_rev = relay6_fwd = relay6_rev = 0;
	relay7_fwd = relay7_rev = relay8_fwd = relay8_rev = 0;	
	//The following code shows all the red lights
	//on the OI to tell the drivers that the autonomous
	//has been disabled
	Pwm1_red = 1;
	Pwm2_red = 1;
	Relay1_red = 1;
	Relay2_red = 1;
	if (irerror == 1) //If the IR has an error, then flash
	{
		printf("IR Sensor Problem, Check connection %d\r");
		errorloop++;
		if (errorloop > 5)
		{
			Pwm1_red = 0;
			Pwm2_red = 0;
			Relay1_red = 0;
			Relay2_red = 0;
		}
		if (errorloop > 9)
		{
			errorloop = 0;
		}
	}

}
I think I took all of our personal, never to be seen code out, and I think I have all the variables declared in the beginning. I give the right for any team to use this, and I give no warranty. If it does not work, you can PM me, and I can try to help. I will not help with any of your personal programming though.

PS: We have tried this on our robot, and it works great! So I encourage any teams that aren't very programming savvy to try to use this to at least do something.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
  #20   Spotlight this post!  
Unread 29-01-2008, 18:42
chattycat14's Avatar
chattycat14 chattycat14 is offline
Registered User
AKA: Jessica
FRC #1228 (Rahway Highschool Indians)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Rahway
Posts: 8
chattycat14 is an unknown quantity at this point
Send a message via AIM to chattycat14
Re: Wiring the IR Receiver

hey,
we have easy c, so if anyone could help then it would be appreciated.
__________________
<3 Jess
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Making the IR receiver Omni Directional Spylake Technical Discussion 0 08-01-2008 13:00
Using the IR Receiver on the Robot LG67 Control System 1 06-01-2008 01:42
GPS receiver John Gutmann Technical Discussion 23 01-03-2007 02:35
IR Receiver zachriggle Electrical 7 09-02-2006 17:11
How to connect the R/C receiver?! Tim Skloss Robotics Education and Curriculum 7 10-12-2003 16:34


All times are GMT -5. The time now is 19:06.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi