Quote:
Originally Posted by neilsonster
You should just follow his advice. If you do add a round function, remember to should add a declaration for the function to the header (.h) file [edit: or at the top of the .c file if you really want...] (sorry if this is obvious to you, but I'm not sure what kind of experience you have). I'm just curious.. why do you need to round? You should avoid using floating point numbers on a robot's processor, since it's easy to run out of memory on those things. Stick to integers if at all possible. Remember that you don't need pinpoint precision when running the robot.
|
Ye i noe wat u mean about the memory running out... For the auto mode i just want a delay for seconds.... my code is using floating numbers.. and i dont want that... i just want a insingle incrementing integer..
my code:
int i = 1;
static int time_i;
i=i+1; // This will increment 'i' by the value 1 every loop
time_i = ((i * 262) / 10000);
But thats going to caculate a floating number... i would just like a rounded integer from that sorta type of logic.... srry if i seem confusing....