|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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
|
||||
|
||||
|
Re: quick c question
Quote:
What happens? |
|
#3
|
|||||
|
|||||
|
Re: quick c question
it should be fine. what is the code exactly?
|
|
#4
|
|||
|
|||
|
Re: quick c question
Quote:
line above it compiles fine |
|
#5
|
|||
|
|||
|
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
|
|||||
|
|||||
|
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;
}
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. Last edited by AIBob : 21-02-2005 at 16:36. |
|
#7
|
|||
|
|||
|
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 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |