LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Arduino outputs

When I declare an Arduino Pin as an output, and I hit play, it seems like arduino tests all the outputs by setting them on a high state momentaniously, for example, I declare pin 30 and 31 as outputs, I conect those to leds. If I hit play, the leds become ON for a milisecond and then they continue the Labview code. This behavior is not desired. I already burned 1 power supply because of this, I want to know if theres a way to disable Arduino checking the pins ?

0 Kudos
Message 1 of 16
(5,246 Views)

LIFA, itself, does not set a pin high when setting the pin mode.  It simply uses the Arduino function pinMode().  (It seems, based on my quick searches, pinMode will leave the pin low on Uno and Mega but not Due)

What Arduino are you using?  How does the signal to the power supply work?  Maybe there is a way to work around the issue.

0 Kudos
Message 2 of 16
(3,862 Views)

What Arduino are you using?  mega adk

How does the signal to the power supply work? 

i bought a 8 relay module (http://www.amazon.com/SainSmart-8-Channel-Relay-Module-Arduino/dp/B0057OC5WK), I was using 12 volts and -12 volts to control a motor, i had the 12 volts on 1 relay and the -12 volts on another relay, both of them go to the motor wire, but since the relay was suposed to be open, there wont be a problem, as soon as I press play, both relays where on and the power supply broke.

Maybe there is a way to work around the issue.

i did this http://prntscr.com/1g6ety

it delays the acvitation of the bits a little at least.. and i will not be using -12 volts anymore, i will just flip the 12 volts so i get an oposite function..

(why is there a high state since the beggining ? because the module works that way, 1 means relay led indicator off)

0 Kudos
Message 3 of 16
(3,862 Views)

Using two independent relays to apply a voltage to the same wire is a really bad idea.  It is way to easy to create a 24V short, which you have already found out.  I would highly recommend that you get an actual DC motor controller as this is exactly what they are made for.

Also, as a tip, you should always have all LIFA functions in-line in LabVIEW (i.e. the resource out should always be connected to the next LIFA VI).

0 Kudos
Message 4 of 16
(3,862 Views)

thanks, i did not understand the last part of your comment, im going to post my VI so you can take a look. It is working fine right now. I got a motor which move a device, theres a linear path with 2 limit switches on both ends, if the device reaches the end the movement finishes.

actually.. i dont know how to upload my VI can you tell me how ?

0 Kudos
Message 5 of 16
(3,862 Views)

There is no advantage (in fact, it's actually detrimental) to branch the Arduino resource as shown in the "Don't do this." example below.

LIFA_Inline.png

You can upload files by clicking on "Use advanced editor" just above spell check and the HTML link for the post.

0 Kudos
Message 6 of 16
(3,862 Views)

I cant do it the way you're showing me becuse it shows an error. Its like wiring 2 paralell boxes.. Here is my code~

0 Kudos
Message 7 of 16
(3,862 Views)

nesasss.jpg

0 Kudos
Message 8 of 16
(3,862 Views)

Ok, I quickly put all the functions in-line like I was suggesting.

One thing that I don't understand is that when you read digital pins 22 and 26, you write the same values to the pins regardless of the state of the "Forward" and "Reverse" buttons.  If this is what you want then you won't need that extra case when you read a 1 on pins 22 and 26 and you can simply write the value 1 to those pins.

Message 9 of 16
(3,862 Views)

ok thanks, when i put the paralell "IF" structures i was thinking of a paralell real circuit but now I understand that it can work in "series" too..

I dont understand about 22 and 26, i use 22 and 26 for limit switch, what do you mean by "you write the same values to the pins regardless of the state of the forward and reverse buttons" ? its not the same, in case that i have a "1" read on pin 22, then i set the "if" cases outputs in "1" which means they will be off because of how module relays work.. if i read a "0" on my pin 22 then one of the cases is "0" which means it will work... sorry for my bad english.

0 Kudos
Message 10 of 16
(3,862 Views)