![]() |
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 |
Re: quick c question
Quote:
What happens? |
Re: quick c question
it should be fine. what is the code exactly?
|
Re: quick c question
Quote:
line above it compiles fine |
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 |
Re: quick c question
Code:
if (counter<60)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. |
Re: quick c question
:P thanks, I don't know what I was thinking. I was trying to get an autonomous mode done an hour before ship
|
| All times are GMT -5. The time now is 04:37. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi