LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

LIFA Base starts motors running on upload

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

0 Kudos
Message 1 of 14
(13,065 Views)

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.

0 Kudos
Message 2 of 14
(6,001 Views)

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

0 Kudos
Message 3 of 14
(6,001 Views)

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);
}
0 Kudos
Message 4 of 14
(6,001 Views)

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().

0 Kudos
Message 5 of 14
(6,001 Views)

but how i can use PID for controlling This Dc MOTOR with Labview interface arduino thank's

0 Kudos
Message 6 of 14
(6,001 Views)