![]() |
Need help with code
ok so i have some autonomous code right now and This code gets the Tilt_servo variable from tracking.c, then goes into a
loop, and waits for a while, then gets the value again and tests it against the previous value to guaranty that it has not changed. If the value has not been updated, we assume that the target has been found and we can then pass the value as the final value. right now this code looks like this Quote:
Thanks |
Re: Need help with code
Is this really the code? If so, the errors are because you are missing a bunch of semicolons (like after "try_again = false"). You should also clean up the curly braces with the else statements
|
Re: Need help with code
This scheme will also not work with the IFI Robot Controller design because you cannot pause execution with a "while" statement or a timing loop for any appreciable amount of time.
Doing so prevents you from servicing the regular radio packets with Getdata/Putdata, and when the Master control doesn't hear from you it automatically shuts your code down -- Red "Code Error" light. |
Re: Need help with code
Code:
angle = TILT_Servo;Couple of Things: 1. There is no Boolean Variables right out of the box for MPLAB. You can get them by assigning your variables as int and then have: #define TRUE 1 #define FALSE 0 at the top of your code 2. Try and use indentation. It will make debugging your code a lot easier 3. I have noticed a lot that MPLAB doesn't like when you don't use {} on single line For/If/While statements. That is why I put those in. 4. == is for conditional statements. IF / While statements = is for assignment statements. There were couple of places where those were messed up If you have any more question feel free to contact me on one of my Instant Messaging ways |
| All times are GMT -5. The time now is 18:01. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi