![]() |
IR not changing state or var
Hello everybody! I have an interesting dilemma!
I have mapped the IR board to Digital Input 1-4 on the RC, and called these to be read in Autonomous. Now, When a button is pressed on the remote in Hybrid, the status of the variable won't change. Though if I am holding the button and reset the robot the variable changes?!:confused: I do not believe that Autonomous is being called after the first routine. As in, I think it's just doing the default and kicking out, rather than looking for the variable. I am including the code for the autonomous (I program in EasyC and am using the code box on the right to copy this, by hand, my laptop has not network.) I only copied 1 output code, the others are copied from the "IF (Out0 =1)" block, and modified for their function Code:
#include "Main.h" |
Re: IR not changing state or var
I would like to help but I can not understnd what your code is supposed to do, could you clarify it?
|
Re: IR not changing state or var
Your first few if statements are setting variables to zero instead of testing for being equal to zero. Replace the = 0 with == 0 to fix that.
I don't understand what the for statements are supposed to be doing. The initialization does nothing, and I suspect you've made the same = vs. == error in the continuation check. |
Re: IR not changing state or var
Thanks.
The FOR statements are only to keep the counter time. There is a 7-step autonomous that can be interrupted by the IR commands. The counter is so it can pick up where it left off. Otherwise, I'll change the operators and cross my fingers! |
Re: IR not changing state or var
Quote:
|
Re: IR not changing state or var
I'm sure pretty your while loop isn't going to do anything because auto gets called in main.c every 26ms or so. so even though you are trying to get stuck in the while loop with 1==1, your not stuck because auto will just get called again.
I'm not entirely sure, but I think this is one problem. (I'm kinda new at this) |
Re: IR not changing state or var
BHOP - easyC / WPILIB will only call the autonomous() function once when the field switches. Also, everything you do in easyC / WPILIB runs at full speed in the user processor. So, his while(1==1) will loop as fast as it can. Any commands going to the Master Processor ex. PWM/OI will sync every 26ms due to the nature of how the master processor is programmed by IFI. But, in this case all the inputs are tied directly to the user processor so the 26ms loop doesn't apply.
|
Re: IR not changing state or var
thanks for that info...i've never tried easyc
|
| All times are GMT -5. The time now is 00:58. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi