|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Automous Code?
I was wondering if anyone had some basic automous code I could look at to start us off with something
Links are great THANKS IN ADVANCE! ![]() |
|
#2
|
||||
|
||||
|
Re: Automous Code?
pwm1 = 255;
pwm2 = 255; while(1) { } that will drive you forward will the end of time. |
|
#3
|
||||
|
||||
|
Re: Automous Code?
|
|
#4
|
|||
|
|||
|
Re: Automous Code?
Quote:
On the topic of auton code: Code:
int autonStep = 1;
int timeCounter = 0;
switch(autonStep)
{
case 1:
pwm01=pwm02 = 255; //drives pwm01 and pwm02 forward.
if(timeCounter >= 100)
{
autonStep++;
}
break;
case 2:
pwm01=pwm02= 127;//stop pwm01 and pwm02.
break;
}
timeCounter ++;
|
|
#5
|
||||
|
||||
|
Re: Automous Code?
I wouldn't use a switch statement for so few options, it would be cleaner with just an if() and else if() statements. Thats what I use pretty much all the time.
Damien is right about the complication of the code. It all depends on what you want it to do of course. Oh and as a general rule, I cant think of any exceptions, you should never add any loops to the code. Ever. It causes problems. There is only the one big main() loop and thats it. There might have been another general one for automomous code, but that would be in the default code.(if is there at all, cant remember) |
|
#6
|
|||
|
|||
|
Re: Automous Code?
Quote:
There are many calculations that would be foolish coding without loops. CORDIC trig functions leaps to mind. But the time in the loop is deterministic. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problems Combining Camera Code and Driving Code | cmurdoch | Programming | 20 | 10-02-2007 16:34 |
| problems using gyro/adc code with camera default code | tanstaafl | Programming | 7 | 22-01-2006 23:09 |
| so lost we need help with automous | evilhunter | Programming | 2 | 21-02-2005 13:54 |
| Team THRUST - Kevin's Code and Camera Code Combine | Chris_Elston | Programming | 3 | 31-01-2005 22:28 |
| 2001 2002 in Automous | SpaceOsc | Control System | 12 | 17-05-2004 01:52 |