![]() |
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????? :confused::ahh: |
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.
|
Re: Odd counter problems
Quote:
Code:
printf("\nArm counter: %i\n", (int)armcounter); |
Re: Odd counter problems
Quote:
PS What type is armcounter? |
Re: Odd counter problems
its a short.
|
Re: Odd counter problems
Quote:
|
Re: Odd counter problems
ok I did and now theres nothing there, its not printing anything.
|
Re: Odd counter problems
Quote:
Code:
printf("Test");--EDIT-- If it doesn't work then post your code and people can look at it. |
Re: Odd counter problems
1 Attachment(s)
It printed test but here it is. I'm using a basic auto right now so i can debug everything first.
|
Re: Odd counter problems
Quote:
--EDIT-- Try changing the %i in the printf to %d. |
Re: Odd counter problems
A few things I saw after glancing at it:
Code:
if (armcounter = 15) //will raise arm.Code:
if (armcounter == 15) //will raise arm.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? |
Re: Odd counter problems
Quote:
|
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.
|
Re: Odd counter problems
Quote:
|
Re: Odd counter problems
Quote:
Code:
printf("Test\n"); |
| All times are GMT -5. The time now is 20:46. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi