04-04-2013 08:37 PM
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:
https://decibel.ni.com/content/docs/DOC-27770
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?
Thanks
-Steve
04-05-2013 02:20 AM
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.
04-05-2013 04:21 PM
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.
Thanks,
-Steve
04-05-2013 04:36 PM
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:
void setup()
{
// Initialize Serial Port With The Default Baud Rate
syncLV();
// Place your custom setup code here
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
}
04-06-2013 08:19 AM
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().
07-15-2013 02:11 PM
but how i can use PID for controlling This Dc MOTOR with Labview interface arduino thank's