Hey, programmer here (using Labview), we have been having some problems with the motor controllers on our robot. I have programmed a button to make a motor go forward. We know that the motor controller works because when we used it for the regular drive it turned red and green as it should. When I use the button to control a motor however the motor controller rapidly flashes red and orange when the button is not in use. When I push the button it flashes green red and orange. I know the code is right because I have used two separate versions, one from chief delphi and one from NI.
You are opening and closing the motor in teleop.vi
This code does not contain the main loop; you must open the motor in Begin.vi, save it as a refnum, then get the refnum in Teleop.vi, use it, and leave it. If you want to be nice and close it, then get the refnum and close it in Finish.vi
You’re actually opening and closing a lot of things in Teleop. That won’t cause problems with some of them, but it will definitely break most of them.
The LabVIEW examples are typically set up as an Open, fed into a While, with a Close after the While. That’s fine for a standalone example, but it isn’t how the full robot code is structured. The robot project should have all the Opens put in the Begin vi, with each resulting reference fed into a registry Set vi. Everything inside the example’s While should go in the Teleop vi, which you might think of as having an implied While around it. Use a registry Get in Teleop instead of another Open; you can see how that’s done with the existing references. Put each Close from the example in the Finish vi, again using the existing code as a pattern.