Conditional Loop is Broken in Vexcode Pro

Hi, as I was coding my auton tonight, I noticed that my while loop in my code was not working, to be clear, I had not tested it before, here is my code:

while(Flywheelspeed.velocity(rpm)<2500){wait(1,msec);)

I also tried this:

while(Flywheelspeed.velocity(rpm)<2500){
    wait(1,msec);
}

Neither of these work, so I tried this:

while(1==1){
    std::cout << "Physics is not broken!!"
}

I got zero outputs, so something is probably wrong.
std::cout works as well.
I also verified that my flywheel was spinning above 2500 rpm.
Any thoughts?
Let me know if I did anything wrong and this is a me issue.

In the second while loop with std::cout you need a delay because there are no vex API calls ( and therefore the scheduler won’t run correctly).

2 Likes

You say it’s not working, can you clarify what about it is not working? Is is just skipping right over it? Never leaving the loop?

Consider that the likelihood that a fundamental piece of code is broken and released into the wild is extremely small. It’s almost certainly something behaving differently than you’re expecting.

How did you measure this? Code wise there is no option for a 1:1 cartridge so the code would have no way of knowing the rpm. You could also simplify this could by using waitUntil.

Thanks for trying to help, we solved the problem, it was just a mistake on my side, and by that time, I couldn’t delete the post.

1 Like