As soon as I upload LIFA Base to my Arduino Uno (R1), both motors connected to Pins 5 and 6 start running continuously at full speed (not desirable).
When I use the following VI that is written for my motor shield, it works correctly:
However, when I push the "Stop" button the motors go back to running at full speed.
How can I fix this in the arduino code?
Try this cleaned up version of that VI (I removed the analog inputs since they don't relate to the shield based on the info on the website).
I added a the "Set Digital Pin Mode" VIs because you should always set the pin mode before using a pin. Then, I added the "Set Digital Pin" VIs immediately after the loop to set the motor speed to zero when you hit the stop button.
Let me know if it works.
I'm sorry. I was ambiguous with my first post. My problem is not with the VI, it is with the arduino sketch (LIFA Base). As soon as I uplaod the sketch to the arduinon, both motors start running full blast.
The VI that I posted above was intended to address the motors being on after you hit the stop button. As for when you upload the sketch, you might need to set the appropriate pins to 0 in the firmware (possibly in the setup section). So, try changing the setup code in LIFA_Base.ino:
// Initialize Serial Port With The Default Baud Rate
// Place your custom setup code here
This worked. Thanks! The reason I didn't do such a thing to begin with, was that I hadn't analyzed the code to see how the interface worked and to ensure I wasn't going to break the labview interface by setting pins in setup().
Nathan, I have been trying to make the labview interface work with my motor shield (OSEPP version http://osepp.com/products/shield-arduino-compatible/motor-servo-shield/) I can not seem to get it. Would it be possible to post the L293D_&_L298_Interface_Arduino.vi file that is compatible with LabView 2010?
My biggest uncertainty is what Arduino pins correspond to the various motors on my OSEPP motor shield? According to osepp, it should be the same as the adafruit version (but my shield has 4 motor connections etc.. ) so I am a bit confused.
Thanks for any help,