|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
If statement in .h file or Indirect addressing? Kevin NAV code...
Ok...so I am not sure how to explain what I need but I know what I want to do.
I am helping our team program this year and really this is the first time I've dabble in C code. I normally program PLCs (programmable logic controllers)...anyway... I noticed that Kevins nav code uses a commands.h file which is a structured something to send commands in a list format to the robot.c file. Very slick and easy. We've made our own functions and commands for our automous mode. What I'd like to do is alter this with some inputs to create multi automous modes. We have all the inputs selections working but not sure what would be the best approach in C code to do what we need. I want to do something like this: Code:
if (input = 1)
{
struct commands command_list[] = {
/* Command parm 1 parm 2 parm 3 */
{CMD_WAIT, 1000, 0, 0},
{CMD_DRIVE, 1500, 0, 0},
{CMD_WAIT, 4000, 0, 0},
}
};
Of course that's not exactly legal in C code.... So if I was doing this in a PLC, I might use what is called indirect addressing, or assigning a varaible to a pointer. Like: struct commands command_list*myvarible*[] = so if myvarible is equal to 1 then run the commands in list #1. If myvarible is equal to 2 then run the commands in list #2. Is there such a thing like this in C Code? I hope that makes sense... |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Example gyro code released. | Kevin Watson | Programming | 60 | 17-03-2005 18:32 |
| Updated: Serial Port Driver Code | Kevin Watson | Programming | 4 | 05-02-2005 18:39 |
| Kevin Watson's Kick-off Demo Code! | Mr. Lim | Programming | 27 | 22-01-2005 03:38 |
| heres the code. y this not working | omega | Programming | 16 | 31-03-2004 15:18 |
| File Sharing and Revision Tracking | Madison | FIRST-related Organizations | 14 | 04-06-2003 18:01 |