My students< who are all brand new 4th Graders, were working on programming a switch for their intake motor, so that they don’t have to hold down the button while they drive.
With some instruction they go to this

But that didn’t work, so eventually they go to this

Which works, but is definitely a lot more complicated to understand than the more obvious “is the motor spinning”?
Any thoughts on what we did wrong?
I’m not very experienced with the motor is spinning block, but i do have another solution thats easier for the team i coach to learn. I teach them to use a variable that changes its value whenever the button is pressed. Then, based on the value you can tell the system to stop or go with a if else statement. In this way, you’re not relying on the motor to report its condition and instead a numerical value.
2 Likes
In picture #1 you have it set to “if IntakeMotor is spinning?,” but in picture #2 you have it set to (the equivalent of) “if drivetrain is moving?”
Did you mean to use drive velocity for the second conditional? It seems like this will only turn on if your drivetrain is still, and will only turn off if it’s moving, can you give more information on how the robot is behaving with both snippets of code?
2 Likes
The “Is spinning” blocks only returns true if the motor is performing a non-blocking version of the “spin for xx degrees” or “spin to position” calls. You would use it to test if the motor had reached its target position if the “and don’t wait” option is selected on those blocks. “Is spinning” is not used with simple “spin forward” commands.
7 Likes
Is there a different function that would work with motor.spin()
?
That’s the same route I guided our team too as well this season.
I’d also recommend adding a comment block above it that explains what’s happening. That’s helpful when reviewing the code later and when displaying the code in the Engineering Log for the judges to quickly understand what the team is trying to achieve.
3 Likes
Thank you. I have taught using variables in the past. They weren’t quite getting it, so we switched to this approach.
2 Likes
Sorry, that second picture should have been using the INTAKE motor, not drive train. I was recreating what they had done to generate the screen shots. My bad.
1 Like
Thank you for explaining. I’ll make sure we keep that in mind going forward.
1 Like
Thank you. They do use comments, I just recreated their blocks for this post.
2 Likes
ChrisR246, please combine your posts into one post next time. If ou highlight the text on the post you want to reply to, ou can quote it, reply with whatever you want, and then repeat for the next post.
1 Like
So I went to each of the 4 or 5 posts I wanted to reply to, just like I am doing here, used the “reply” and typed my reply for each. You can actually see them “under” each individual comment. Why they all show up again all lumped together, I’m unsure why they show up at the bottom as well
Sorry if I was confusing. I was jusst pointing out that you could condense your 4 posts into one post, helping keep the topic a bit less cluttered.
2 Likes