My team recently built a double motor flywheel which works pretty well. But I was wondering why, and how to stop, our motor from “auto braking” after I release the buttons running the flywheel. As soon as I let go of the buttons, the flywheel immediately stops, which I understand will quickly strain motors. Is there any way to stop this using block code?
Maybe you could make a toggle flywheel.
(i.e.)
if (Button pressed/pressing) spin flywheel.
If (other button pressed/pressing) stop flywheel.
You could use the same method to make different buttons auto-set velocities for the flywheel.
Use “set motor stopping to coast”. It should be under set motor stopping to brake and then just change it.
Set the flywheels motors’ brake type to “coast”. In Vexcode V5 text(C++) this would be FlywheelMotor.setStopping(coast);.
In block code, click coast on the drop down menu
This would be the best option because it used more energy to spin it up than to keep it spinning. I do this with the “when button pressed” block to start it, and another to stop it.
I just whipped up some single button toggle on/off code for you:
Double Flywheel Toggle code.v5blocks (6.0 KB)
Feel free to use it
Thanks so much! Definitely gonna have to try this. Thanks again!
Well Wishes -15800A
Shouldn’t the ‘else’ block have a “set flywheelon = true” in there? Looks like the code, as is is posted, will either 1) only spin while the button is held down or 2) fail to stop after it’s manually started the first time.
I know the OP question is answered… need a ‘coast’ statement. But the code seems wrong…
Looks like it, not rlly good at this kinda thing
Oh yeah looks like i forgot that thanks
Here’s the fixed version:
togglecodefixedsorryitwaswrong.v5blocks (5.7 KB)
So it reverses spin direction each time you press the button?
That’s what I get for not checking my code, can’t believe it happened twice though wow
togglecode_versionwhateveritisnow.v5blocks (5.7 KB)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.