|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Potentiometer values not changing
Yes the else-if is in a while loop.
|
|
#2
|
|||||
|
|||||
|
Re: Potentiometer values not changing
That part of the code prints the value of pot. Is there anything in the loop that sets the value? Specifically, do you ever do another DartPot->Get() after you define the variable?
|
|
#3
|
|||
|
|||
|
Re: Potentiometer values not changing
Code:
While(IsOperatorControl()&& IsEnabled()){
double pot = DartPot->Get();
if(){
}
else if(stick->GetRawButton(1) == 1){
std::cout<<(pot)<<std::endl;
}
}
|
|
#4
|
|||||
|
|||||
|
Re: Potentiometer values not changing
If I'm reading the C++ standard correctly, the variable pot will be initialized once when the loop begins. It doesn't get reinitialized every iteration of the loop. You can test this by disabling the robot and seeing if the value printed changes when you reenable the robot.
If that happens as I think it will, you should add a line pot = DartPot->Get(); to the loop somewhere before you use the value of pot. |
|
#5
|
|||
|
|||
|
Re: Potentiometer values not changing
I tried putting pot = DartPot->get(); in my while loop and tried using cout to print DartPot->Get() directly (not using a variable) but neither worked.
|
|
#6
|
|||||
|
|||||
|
Re: Potentiometer values not changing
Let's step back from the code for a moment and verify that you have the wiring correct. Tell us what each pin on the pot is connected to. Be extremely specific, so there is no room for doubt about what you are telling us.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|