|
Re: Little help Please (with dead reconing code)
you got the right idea, but you cant use the for loop- the uP will execute that code all at once, and only output the pwm values once
the entire code runs in one big loop
A. first the operator interface commands are read in (a serial input stream)
B. then the block of user code runs once (including your custom auton code)
C. then the pwm commands are sent out to the motors and relay spikes
D. goto A
this loop runs as long as the robot is on - and it takes about 26mS each time through
thats why I had that variable auton_time incrementing at the start of the auton code - everytime the loop runs that count goes up by 1, and you know another 26mS of your life has gone by.
so if I look for auton_time to be = 10, that means 260mS have gone by - about a quarter of a second. If I look for it to be 40, thats about a second.
so if you put a 'for' statement up there between B and C, it will sit and spin on itself very quickly, maybe 100 uS, and then go on like it wasnt even there.
Last edited by KenWittlief : 20-02-2004 at 22:04.
|