LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to turn 3 LEDs on and off

Hi there!

 

New to LabView and looking for some help.  I am learning this from a course, and we didn't get much introduction to the specifics when using Arduino.  I am trying to have 3 toggle switches that each control their own separate LED on and off.  I can run the program and it works fine, and when I hit the stop button (on the front panel) I get this error: "Error 5003 occurred at LabVIEW Interface for Arduino.lvlib:Set Digital Pin Mode.viLabVIEW Interface for Arduino.lvlib:Digital Write Pin.viLabVIEW Interface for Arduino.lvlib:Init.vi.  A timeout occurred while trying to read form the Arduino."  Below is what my VI looks like.  Any help is greatly appreciated!

 

ControllingLEDs

0 Kudos
Message 1 of 9
(4,790 Views)

Make the array of 3 LEDs & give input as true. then shift the input

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 2 of 9
(4,768 Views)

Can you post your VI & show the LEDs you want to glow simultanously (Hope so)

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 3 of 9
(4,764 Views)

So I have fixed the problem and was hoping you could confirm something for me.  Attached is the VI and I have also included a new picture of my block diagram.  My question is for the write commands for each of the LEDs, are they supposed to be "parallel" as they are in the first picture, or in "series" as in the second one?

 

ControllingLEDs.jpg

0 Kudos
Message 4 of 9
(4,732 Views)

The error was outside of your loop (if I am reading the diagram correctly).  You had one open but tried to close the resource three times.  My guess is the first closed OK but then the 2nd and 3rd timed out...

0 Kudos
Message 5 of 9
(4,726 Views)

That is true, I ended up figuring that out, but I removed 2 of them and still got the error.  If, however, I left the one in the middle, I wouldn't get an error.  Since I can't tie the 3 write commands outside of the loop to one close command, I think I must put them in series in order it to always close when I want it to.  Otherwise, how will I know which write command to put the close command after?

0 Kudos
Message 6 of 9
(4,721 Views)

You have a serial connection and you cannot send commands in parallel. You have a single connection and you would only close it once. Keep the sequential code.

0 Kudos
Message 7 of 9
(4,717 Views)

Ok thanks Dennis, that's what I was thinking.  Like I said, never really learned some of the specifics so took some trial and error to get there Smiley Happy

0 Kudos
Message 8 of 9
(4,715 Views)

Using data flow it might work once (or a lot) correctly in line 2 but it would not be a sure thing.  It would be better to combine everything back into one and then close.  In this case combine your error outs with a "merge errors" vi and after that close the resource -- feeding the merged error line into the close reference.

0 Kudos
Message 9 of 9
(4,712 Views)