Go to Post Well, the cake could either be a simple cake Or It is blue, so that obviously means that we are having a water game this year. - big1boom [more]
Home
Go Back   Chief Delphi > Technical > Programming
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
  #1   Spotlight this post!  
Unread 17-01-2008, 20:25
drewjones13's Avatar
drewjones13 drewjones13 is offline
Registered User
no team
Team Role: College Student
 
Join Date: Jan 2007
Rookie Year: 2006
Location: CA
Posts: 13
drewjones13 is an unknown quantity at this point
Exclamation HELP!!! STUCK WITH SUB ROUTINES WITH THE IR!!!

we are having issues with our IR coding in hybrid mode, below is what we have set up, for some reason its only running the first subroutine as if rc_dig_in10 is already initialized to "on" at the start of the code.

Auton Code:

Code:
  
time1 = time1 + 1;
if (time1 <= 5)
{
	rc_dig_in10 = rc_dig_in11 = rc_dig_in12 = rc_dig_in13 = 0;
	pwm01 = pwm02 = 127;
}
else if (rc_dig_in10 = 1)
{
	cmd0();
}
else if (rc_dig_in11 = 1)
{
	cmd1();
}
else if (rc_dig_in12 = 1)
{
	cmd2();
}
else if (rc_dig_in13 = 1)
{
	cmd3();
}
else
{
	rc_dig_in10 = rc_dig_in11 = rc_dig_in12 = rc_dig_in13 = 0;
	pwm01 = pwm02 = 127;
}
Subroutines:

Code:
unsigned char cmd0()
{
	pwm01 = 190;
	pwm02 = 190;
	return 0;	
}
unsigned char cmd1()
{
	pwm01 = 64;
	pwm02 = 64;
	return 0;	
}
unsigned char cmd2()
{
	pwm01 = 190;
	pwm02 = 64;
	return 0;	
}
unsigned char cmd3()
{
	pwm01 = 64;
	pwm02 = 190;
	return 0;	
}

Last edited by drewjones13 : 17-01-2008 at 20:35. Reason: Needed code blocks
  #2   Spotlight this post!  
Unread 17-01-2008, 20:52
psy_wombats's Avatar
psy_wombats psy_wombats is offline
Registered User
AKA: A. King
FRC #0467 (Duct Tape Bandits)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Shrewsbury MA
Posts: 95
psy_wombats has a spectacular aura aboutpsy_wombats has a spectacular aura aboutpsy_wombats has a spectacular aura about
Re: HELP!!! STUCK WITH SUB ROUTINES WITH THE IR!!!

I believe the if statements are your problem. You're only using one equals sign. That will actually assign the bit the '1' rather than checking equivalence. You need to use the == operator instead.
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
Out with the match list printouts, in with... Pat Fairbank General Forum 19 07-02-2005 20:15
need help with the ir tinderfitles Programming 3 03-02-2004 15:31
Help with the balls! tchescow Kit & Additional Hardware 11 20-01-2004 10:52
Help with the storyboard. LizJJury 3D Animation and Competition 11 13-01-2003 08:37
Help with the gyro chip Team852 Electrical 1 10-01-2003 22:31


All times are GMT -5. The time now is 11:07.

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