On Wed, Jan 18, 2017 at 01:26:52PM -0500, Evan Koblentz via vcf-midatlantic wrote:
Maybe. Perhaps there is another explanation: Consider whether when you press button 0- does LOGO give you ONE indication or is it as LONG as you hold it it gives you continuous "button pressed" indications?
I think just one
"I think" is where I have wasted more hours looking in the wrong place than I want to admit. Warning: Since you say you aren't a experienced programmer preachy exposition follows. Programming is a house of cards of mental models. When one doesn't match reality you end up with a pile on the table instead of your pretty design. The common models are how does the hardware/language work, what you are trying to accomplish, and the steps the computer needs to do to accomplish it. When you get to the spot where you're saying this should be working you need to see which model/assumption is wrong. In your case you are assuming the behavior of the Lego call and that something is wrong/insufficent with Lego so it can't be accomplished. Switching to Basic will help in that case. If it's really your algorithm/button behavior that is wrong you will end up with the same behavior in Basic. Switching to Basic may have other advantages such as more powerful language and being able to get all the help you can stand from others who know it. The best thing to do when reality doesn't match what you think it should be doing is to try to understand what the underlying difference is. Your assumption is you should get one motor state change per button push. One generally available debugging method is to add a print statement to verify. Add one to the turn motor on and turn motor off path. Then see what you get with the button push. Possible things you could see are not always getting a print, lots of prints, or it prints what you expect but the motor isn't doing what the prints say you commanded it to do. Each leads you down a next step. The multiple prints would question the assumption of one button press event per press. You can do a separate test of just the button press to verify its behavior. I have run into many occasions where the documentation is unclear or flat out wrong on how something operates.