|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
I know it works because it works in all the other modes, just not the one with the subroutines, we have a dip switch to choose autonomous modes. but here are the user_routines_fast.c and user_routines.h files (attached)
|
|
#2
|
|||||
|
|||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
Code:
if (rc_dig_in11 = 1) /* 1st Autonomy code */ The code you posted will always run the BASH routine. You need to change all those single = to double == in your if and else if statements. |
|
#3
|
||||
|
||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
Quote:
As a note to any one else who ever needs help the more code you post the better we can help, don't worry about people stealing it, it wont work on our robots anyway. James |
|
#4
|
||||
|
||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
I agree with Alan and James that a problem exists in the use of the assignment operator, but the initial problem stated that the code was stuck in Left. I don't see how this could be reached. How was it determined that it was getting stuck in Left?
|
|
#5
|
||||
|
||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
i had a student telling me what directions the wheels were turning and i took his word for it instead of double checking, but thank you all for the help
|
|
#6
|
||||
|
||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
I still think we need to see the rest of the code, or at least how the time variable is defined. If it isn't defined static, the variable will be re-initialized everytime its host entity is restarted. So if it's at the top of your function, and this function runs over and over every loop, it will be reinitialized every loop to 0, no matter how much you increment it. Or, time can be a global and it will retain its value, but if you're assigning 0 to it every loop that will also ruin your day. I think you have a pretty simple (and somewhat hard to notice) problem that I'm unfortunately very familiar with, as Mark McLeod can tell you, how many times did I hit Chris with the robot again?
![]() |
|
#7
|
||||
|
||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
the .c file is attached above, but i know for a fact thats not the problem because ive defined "time" and incrimented it the same way for 3 years now and i have had no problem with that at all.
|
|
#8
|
|||||
|
|||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
Quote:
|
|
#9
|
||||
|
||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
Quote:
|
|
#10
|
||||
|
||||
|
Re: !HELP! IM STUCK IN A SUBROUTINE!!! !HELP!
Quote:
As far as what I meant, I meant that a local variable inside of a function would be reset everytime the function ended and started again. Not sure why I worded it that way, let me just chalk it up to a goofy morning eh? ![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| RC Controller Stuck | bhk88 | Programming | 1 | 31-01-2006 17:46 |
| Stuck on Camera Mount | busterblade16 | Programming | 2 | 14-02-2005 22:07 |
| stuck in programming mode | Shu Song | Control System | 2 | 29-04-2004 16:44 |
| help! Am really stuck!!!! | pagemauck | Programming | 8 | 29-01-2004 12:38 |
| guy stuck in toilet! | robot180 | Chit-Chat | 8 | 14-11-2003 22:27 |