Why does my controller program make the flywheel go slow

I think your code is cycling the motor when you are holding the button down.

Pseudo code
//Cycle 1
Spintime  is 0 so 
it calls the first block
turns motor on and 
sets Spintime to 1

//Cycle 2
Spintime is 1 (not 0) so
it calls the second block
turns motor off and
set Spintime to 0

Every 250 milliseconds it flips the motor from on to off then back to on. On / Off / On / Off

The Spintime variable is not latching and essentially running your motor at 1/2 speed.

Shameless plug: On/off switchable motor - #13 by Hudsonville_Robotics

4 Likes