Go to Post Oh, the magic smoke will just make make it seem a bit more like Christmas. - CJO [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
  #46   Spotlight this post!  
Unread 16-03-2004, 13:49
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: quick question: TIMERS

Huh? You are talking about the IO on the RC, right? In auto mode, the OI transmits inputs as neutural.
  #47   Spotlight this post!  
Unread 16-03-2004, 14:48
Xufer's Avatar
Xufer Xufer is offline
8 Seasons and as stable as ever
AKA: Working, 2/4 degrees complete still schooling...
FRC #1740 (The Cyber Colonels)
Team Role: Engineer
 
Join Date: Jan 2003
Rookie Year: 1999
Location: Waterford, CT
Posts: 231
Xufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to behold
Send a message via AIM to Xufer Send a message via MSN to Xufer Send a message via Yahoo to Xufer
Re: quick question: TIMERS

so it would be like:

#define digin10old

then later on ....

digin10old = (rc_dig_in10)
putdata()
__________________


If saftey is first and i put FIRST ahead of everything, then i must be the safest guy in the world.

Team 521 Alumni -- Team 1740 Mentor-- Go Go 1740!
Sometimes I think I've been doing this too long and other times I think I haven't done this enough... but all the times I'm sure I'm crazy
Photonics, It's Your Future
  #48   Spotlight this post!  
Unread 16-03-2004, 16:10
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: quick question: TIMERS

Quote:
Originally Posted by Xufer
so it would be like:

#define digin10old

then later on ....

digin10old = (rc_dig_in10)
putdata()
No, it would not be like that, for a whole bunch of reasons.

Contrary to an earlier post, the RC inputs such as rc_dig_in10 do work during autonomous mode, so there's no reason to do it this way. The advice to save the values for later use applies only to OI inputs (knobs and switches, mostly) that you want to use to configure autonomous operation.

Also, variables in c aren't declared using #define statements. The proper syntax is not trivial, but it is not important here, since you don't need to use a variable for this purpose.
  #49   Spotlight this post!  
Unread 16-03-2004, 17:56
Xufer's Avatar
Xufer Xufer is offline
8 Seasons and as stable as ever
AKA: Working, 2/4 degrees complete still schooling...
FRC #1740 (The Cyber Colonels)
Team Role: Engineer
 
Join Date: Jan 2003
Rookie Year: 1999
Location: Waterford, CT
Posts: 231
Xufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to behold
Send a message via AIM to Xufer Send a message via MSN to Xufer Send a message via Yahoo to Xufer
Re: quick question: TIMERS

so it would be done how then ?
__________________


If saftey is first and i put FIRST ahead of everything, then i must be the safest guy in the world.

Team 521 Alumni -- Team 1740 Mentor-- Go Go 1740!
Sometimes I think I've been doing this too long and other times I think I haven't done this enough... but all the times I'm sure I'm crazy
Photonics, It's Your Future
  #50   Spotlight this post!  
Unread 16-03-2004, 19:02
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: quick question: TIMERS

Quote:
Originally Posted by Xufer
so it would be done how then ?
It would be done the way Mark McLeod explained back in response #42, testing the digital input with a simple if statement.
  #51   Spotlight this post!  
Unread 17-03-2004, 13:20
Xufer's Avatar
Xufer Xufer is offline
8 Seasons and as stable as ever
AKA: Working, 2/4 degrees complete still schooling...
FRC #1740 (The Cyber Colonels)
Team Role: Engineer
 
Join Date: Jan 2003
Rookie Year: 1999
Location: Waterford, CT
Posts: 231
Xufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to behold
Send a message via AIM to Xufer Send a message via MSN to Xufer Send a message via Yahoo to Xufer
Re: quick question: TIMERS

Code:
if (rc_dig_in18=1)	{

			if (cnttick < 34 )
			{ 
				pwm05 = 60;
  				 }
			if (cnttick > 35 )
			{ 
				pwm05 = 127;
  				 }
			if (cnttick < 30 )
			{ 
				pwm04 = 0;
  				 }
			if (cnttick < 32 )
			{ 
				pwm04 = 127;
  				 }
//raises arm up for 40 ticks 1 second(s) /\ /\

// drive motors from here on out \/  \/
			
			if (cnttick > 35 && cnttick < 90 ) 
			{ 
				pwm01 = 190;
  				 }

			if (cnttick > 35 && cnttick < 90 )
			{ 
				pwm02 = 190;
  				 }
			if (cnttick > 92  && cnttick <= 122)
			{
				pwm01 = 190;
			}

			if (cnttick > 92 && cnttick <= 122)
			{
				pwm02 = 53;
			}
			if (cnttick > 130 && cnttick < 160 )
			{ 
				pwm01 = 190;
  				 }

			if (cnttick > 130 &&  cnttick < 160)
			{ 
				pwm02 = 190;
  			 }
			if (cnttick > 163  && cnttick <= 183)
			{
				pwm01 = 190;
			}

			if (cnttick > 163 && cnttick <= 183)
			{
				pwm02 = 53;
			}
			if (cnttick > 223 && cnttick < 250 )
			{ 
				pwm01 = 190;
  				 }

			if (cnttick > 223 && cnttick < 250 )
			{ 
				pwm02 = 190;
  			 }
			if (cnttick > 255  && cnttick <= 275)
			{
				pwm01 = 190;
			}

			if (cnttick > 255 && cnttick <= 275)
			{
				pwm02 = 53;
			}

}

else {
			pwm01=210;
}
when i do it like that reguardless of the switch it always works like the switch is on even when its off.
__________________


If saftey is first and i put FIRST ahead of everything, then i must be the safest guy in the world.

Team 521 Alumni -- Team 1740 Mentor-- Go Go 1740!
Sometimes I think I've been doing this too long and other times I think I haven't done this enough... but all the times I'm sure I'm crazy
Photonics, It's Your Future
  #52   Spotlight this post!  
Unread 17-03-2004, 13:29
10intheCrunch's Avatar
10intheCrunch 10intheCrunch is offline
Who's John V-Neun?
AKA: Alex Baxter
None #0254 (Cheesy Poofs)
Team Role: College Student
 
Join Date: Feb 2004
Rookie Year: 2004
Location: San Jose, CA
Posts: 129
10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough
Send a message via AIM to 10intheCrunch
Re: quick question: TIMERS

Quote:
Contrary to an earlier post, the RC inputs such as rc_dig_in10 do work during autonomous mode, so there's no reason to do it this way. The advice to save the values for later use applies only to OI inputs (knobs and switches, mostly) that you want to use to configure autonomous operation.
My mistake. Sorry to confuse...

Your code seems ok at first glance...why don't you put this statement in your Process_data function:

printf("%d\n", (int)rc_dig_in18);

Check the console printout while your program cable is plugged in. Make sure that it changes properly with the switch on your robot.

Too improve efficiency: use else if statements. For example:

if(ticks < 15)
blah;
else if (ticks < 35)
blah;

That will handle your decisions faster...

Sorry again if I confused you eariler.
__________________
~Alex Baxter
Programming, Arms operation, Team 254
  #53   Spotlight this post!  
Unread 17-03-2004, 13:36
Xufer's Avatar
Xufer Xufer is offline
8 Seasons and as stable as ever
AKA: Working, 2/4 degrees complete still schooling...
FRC #1740 (The Cyber Colonels)
Team Role: Engineer
 
Join Date: Jan 2003
Rookie Year: 1999
Location: Waterford, CT
Posts: 231
Xufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to behold
Send a message via AIM to Xufer Send a message via MSN to Xufer Send a message via Yahoo to Xufer
Re: quick question: TIMERS

Quote:
Originally Posted by 10intheCrunch
My mistake. Sorry to confuse...

Your code seems ok at first glance...why don't you put this statement in your Process_data function:

printf("%d\n", (int)rc_dig_in18);

Check the console printout while your program cable is plugged in. Make sure that it changes properly with the switch on your robot.

Too improve efficiency: use else if statements. For example:

if(ticks < 15)
blah;
else if (ticks < 35)
blah;

That will handle your decisions faster...

Sorry again if I confused you eariler.
i stuck in the printf statement and it shows the switch on and off depending on the position, so i know its not the switch its something i did.
__________________


If saftey is first and i put FIRST ahead of everything, then i must be the safest guy in the world.

Team 521 Alumni -- Team 1740 Mentor-- Go Go 1740!
Sometimes I think I've been doing this too long and other times I think I haven't done this enough... but all the times I'm sure I'm crazy
Photonics, It's Your Future
  #54   Spotlight this post!  
Unread 17-03-2004, 13:50
pink967 pink967 is offline
Linn-Marian
AKA: Christa Mae
#0967 (HTML)
Team Role: Coach
 
Join Date: Mar 2004
Location: Marion, Iowa
Posts: 4
pink967 is an unknown quantity at this point
Send a message via AIM to pink967 Send a message via Yahoo to pink967
Unhappy Re: quick question: TIMERS

you guys are all really smart...i need to learn this stuff, or else i don't get to be on my team next year
__________________
I tried to sniff coke once...


...but the ice cubes got stuck
  #55   Spotlight this post!  
Unread 17-03-2004, 14:07
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: quick question: TIMERS

Quote:
Originally Posted by Xufer
Code:
if (rc_dig_in18=1)	{
when i do it like that reguardless of the switch it always works like the switch is on even when its off.
That's because you've fallen into a common trap with the c language's syntax. Testing for equality is done with the == "is equal" operator, and you've instead used the = "assignment" operator. Your code assigns the value "1" to the variable "rc_dig_in18", and then tests the result -- which is always 1, interpreted as true by the software.

What your first line should say instead is this:
Code:
if (rc_dig_in18==1)	{
Or you could leave off the explicit test for 1, and let c's boolean rules work for you:
Code:
if (rc_dig_in18)	{
That should take care of the problem you're having.
  #56   Spotlight this post!  
Unread 17-03-2004, 21:37
Xufer's Avatar
Xufer Xufer is offline
8 Seasons and as stable as ever
AKA: Working, 2/4 degrees complete still schooling...
FRC #1740 (The Cyber Colonels)
Team Role: Engineer
 
Join Date: Jan 2003
Rookie Year: 1999
Location: Waterford, CT
Posts: 231
Xufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to beholdXufer is a splendid one to behold
Send a message via AIM to Xufer Send a message via MSN to Xufer Send a message via Yahoo to Xufer
Re: quick question: TIMERS

Quote:
Originally Posted by Alan Anderson
That's because you've fallen into a common trap with the c language's syntax. Testing for equality is done with the == "is equal" operator, and you've instead used the = "assignment" operator. Your code assigns the value "1" to the variable "rc_dig_in18", and then tests the result -- which is always 1, interpreted as true by the software.

What your first line should say instead is this:
Code:
if (rc_dig_in18==1)	{
Or you could leave off the explicit test for 1, and let c's boolean rules work for you:
Code:
if (rc_dig_in18)	{
That should take care of the problem you're having.
mmk thnx, but j/w how would i do it if i was to have like 4 auton modes i have a sitch box that will occupy 6 dig_in's
__________________


If saftey is first and i put FIRST ahead of everything, then i must be the safest guy in the world.

Team 521 Alumni -- Team 1740 Mentor-- Go Go 1740!
Sometimes I think I've been doing this too long and other times I think I haven't done this enough... but all the times I'm sure I'm crazy
Photonics, It's Your Future

Last edited by Xufer : 17-03-2004 at 21:39.
  #57   Spotlight this post!  
Unread 18-03-2004, 07:28
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: quick question: TIMERS

Quote:
Originally Posted by Xufer
mmk thnx, but j/w how would i do it if i was to have like 4 auton modes i have a sitch box that will occupy 6 dig_in's
Four modes and six dig ins? To do four modes, you only need 2! With 6, you can have 64 modes!
  #58   Spotlight this post!  
Unread 18-03-2004, 08:42
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: quick question: TIMERS

Quote:
Originally Posted by Xufer
...how would i do it if i was to have like 4 auton modes...
You have a couple of options. Simplest in your case would probably be to do something like this:
Code:
// somehow get a number in the "auto" variable
  auto = (rc_dig_in18<<2) | (rc_dig_in17<<1) | (rc_dig_in16);
// or whatever it takes to turn your switches into a value
  if (auto==1)
  {
    // code for mode 1
  }
  if (auto==2)
  {
    // code for mode 2
  }
  // etc.
It might theoretically be more efficient to use a switch/case statement instead of a string of ifs, but you probably have enough to focus on right now without worrying about learning another control structure.
  #59   Spotlight this post!  
Unread 18-03-2004, 08:49
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: quick question: TIMERS

Quote:
Originally Posted by Astronouth7303
Four modes and six dig ins? To do four modes, you only need 2! With 6, you can have 64 modes!
Just to show what he means:
Code:
      On   Off
sw1   1      2
sw2   3      4
Where sw1 and sw2 are the two switches and the numbers in the center are the automous modes.
__________________

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
Quick Question Burgabot Programming 31 02-12-2003 19:22
Quick <hr> question Jack Website Design/Showcase 1 31-01-2003 22:19
A quick question Joelster Technical Discussion 6 10-02-2002 09:09
quick question about qualifying points Hymnson General Forum 4 25-09-2001 21:19
Quick Question, i guess Andrew Rudolph Motors 1 12-08-2001 14:39


All times are GMT -5. The time now is 12:47.

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