Go to Post At this point I think I've absorbed more aluminum into my blood than the iron that was already there. - hectorcastillo [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 21-02-2005, 15:45
shobuda999 shobuda999 is offline
Registered User
None #1995
 
Join Date: Jan 2005
Rookie Year: 2001
Location: Connecticut
Posts: 7
shobuda999 is an unknown quantity at this point
quick c question

is it possible to do something like
variable1 = variable2;
if both variables are ints? for some reason, we're not able to do this and I'm pretty sure its allowed.

thanks,

Dan
  #2   Spotlight this post!  
Unread 21-02-2005, 15:52
Jon236's Avatar
Jon236 Jon236 is offline
Registered User
AKA: Jon Mittelman
FRC #2648 (Infinite Loop)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2000
Location: Windsor, Maine
Posts: 741
Jon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond repute
Re: quick c question

Quote:
Originally Posted by shobuda999
is it possible to do something like
variable1 = variable2;
if both variables are ints? for some reason, we're not able to do this and I'm pretty sure its allowed.

thanks,

Dan

What happens?
  #3   Spotlight this post!  
Unread 21-02-2005, 15:53
nehalita's Avatar
nehalita nehalita is offline
Robots are friends
AKA: tagger fanatic
FRC #1345 (Platinum Dragons); FRC# 97 (RoboRuminants)
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Ft. Laud, FL
Posts: 870
nehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond reputenehalita has a reputation beyond repute
Send a message via AIM to nehalita Send a message via MSN to nehalita Send a message via Yahoo to nehalita
Re: quick c question

it should be fine. what is the code exactly?
__________________
"Relativity applies to physics, not ethics." Thank you Einstein
MIT '10

Proud Member of H.I.L.
The PLATINUM DRAGONS are on FIRE!
  #4   Spotlight this post!  
Unread 21-02-2005, 15:54
shobuda999 shobuda999 is offline
Registered User
None #1995
 
Join Date: Jan 2005
Rookie Year: 2001
Location: Connecticut
Posts: 7
shobuda999 is an unknown quantity at this point
Re: quick c question

Quote:
Originally Posted by Jon236
What happens?
I get a syntax error on the line below, but when I comment out the var1 = var2;
line above it compiles fine
  #5   Spotlight this post!  
Unread 21-02-2005, 16:17
shobuda999 shobuda999 is offline
Registered User
None #1995
 
Join Date: Jan 2005
Rookie Year: 2001
Location: Connecticut
Posts: 7
shobuda999 is an unknown quantity at this point
Re: quick c question

[above]
int counter = 0;
int tracker = 0;
counter ++
[below]

if (counter<60)
{
arm = 0;
}
tracker = counter;
else if (counter<tracker+32)
{
arm = 127;
l_motor=r_motor=191;
}
tracker = counter;
else if(counter < tracker + 55)
{
l_motor=r_motor=127;
arm = 255;
}

this is for dead reckoning without any kind of sensor using a clock of sorts.
i know this seems kind of strange, the reason I'm doing it this way is so I can easily make slight changes without having to change every value

thanks,
Dan
  #6   Spotlight this post!  
Unread 21-02-2005, 16:32
AIBob's Avatar
AIBob AIBob is offline
AI Programmer
AKA: Bob Frank DOT org
FRC #0358 (Hauppauge Robotic Eagles)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Long Island, NY (in Binghamton now)
Posts: 297
AIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to behold
Send a message via ICQ to AIBob Send a message via AIM to AIBob Send a message via MSN to AIBob Send a message via Yahoo to AIBob
Re: quick c question

Code:
if (counter<60)
{
arm = 0; 
}
tracker = counter;
else if (counter<tracker+32)
{
arm = 127; 
l_motor=r_motor=191; 
}
tracker = counter;
else if(counter < tracker + 55)
{
l_motor=r_motor=127; 
arm = 255; 
}
You have it being set between the else ifs.
there is not if that the else is attached to.
This is what is giving you the error, not the variable setting itself, just the placement of the setting.

Also note: you are setting tracker to counter before you check if it less than counter.
__________________
- from B B frank


Last edited by AIBob : 21-02-2005 at 16:36.
  #7   Spotlight this post!  
Unread 22-02-2005, 13:51
shobuda999 shobuda999 is offline
Registered User
None #1995
 
Join Date: Jan 2005
Rookie Year: 2001
Location: Connecticut
Posts: 7
shobuda999 is an unknown quantity at this point
Re: quick c question

thanks, I don't know what I was thinking. I was trying to get an autonomous mode done an hour before ship
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: Animation rules? Yov 3D Animation and Competition 14 14-12-2004 15:23
A quick IR sensor question PBoss Programming 7 28-03-2004 21:02
Quick Newbie Question Gobiner Programming 5 16-12-2002 12:49
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


All times are GMT -5. The time now is 18: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