|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Odd counter problems
Ok well, I'm trying to run through a loop where it does
armcounter++; Armcounter is defined at the top of user_routines_fast.c. I try a print_f to print out armcounter but it gives [null] on the ifi_loader. My motors just keep running for ever because it doesn't ever have armcount equal to the number I supply. Any clues????? ![]() ![]() |
|
#2
|
||||||
|
||||||
|
Re: Odd counter problems
you need to declare armcounter as a static int. Otherwise, it gets created and destroyed on the stack each time you enter and leave the function.
|
|
#3
|
||||
|
||||
|
Re: Odd counter problems
Quote:
Code:
printf("\nArm counter: %i\n", (int)armcounter);
|
|
#4
|
||||
|
||||
|
Re: Odd counter problems
Quote:
PS What type is armcounter? |
|
#5
|
|||
|
|||
|
Re: Odd counter problems
its a short.
|
|
#6
|
||||
|
||||
|
Re: Odd counter problems
Quote:
|
|
#7
|
|||
|
|||
|
Re: Odd counter problems
ok I did and now theres nothing there, its not printing anything.
|
|
#8
|
||||
|
||||
|
Re: Odd counter problems
Quote:
Code:
printf("Test");
--EDIT-- If it doesn't work then post your code and people can look at it. |
|
#9
|
|||
|
|||
|
Re: Odd counter problems
It printed test but here it is. I'm using a basic auto right now so i can debug everything first.
|
|
#10
|
||||
|
||||
|
Re: Odd counter problems
Quote:
--EDIT-- Try changing the %i in the printf to %d. |
|
#11
|
||||||
|
||||||
|
Re: Odd counter problems
A few things I saw after glancing at it:
Code:
if (armcounter = 15) //will raise arm. pwm06=0; else armcounter++; pwm06=255; Code:
if (armcounter == 15) //will raise arm.
pwm06=0;
else {
armcounter++;
pwm06=255;
}
That said, I believe the code in its original form should have printf'd 15 over and over and over. Was it doing that, or just not printing anything? |
|
#12
|
||||
|
||||
|
Re: Odd counter problems
Quote:
![]() |
|
#13
|
|||
|
|||
|
Re: Odd counter problems
Well the = was something i accidently did when moving it i had it in the code i was using. and btw its just not printing anything.
|
|
#14
|
||||
|
||||
|
Re: Odd counter problems
Quote:
|
|
#15
|
|||
|
|||
|
Re: Odd counter problems
Quote:
Code:
printf("Test\n");
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Meeting FIRST People in odd places | Jeff Waegelin | General Forum | 219 | 04-03-2012 13:10 |
| Do you all have problems with.... | Munkaboo | Website Design/Showcase | 19 | 03-03-2003 19:51 |
| Joystick problems | archiver | 2001 | 3 | 24-06-2002 02:40 |
| A couple of problems I observed at the MAR | archiver | 2000 | 3 | 23-06-2002 22:27 |
| Radio problems -- not | archiver | 2000 | 1 | 23-06-2002 22:23 |