LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

can't get the connection with arduino working when using classes in labview

Solved!
Go to solution

Hi everyone, 

 

I just started to get familiar with classes in labview, so I don't have that much knowledge in it and was thinking if I can use classes when I want to maintain a serial port connection with Arduino. 

 

The program in general: 

I have five servo motors, which corresponds each finger on a hand. Each motor will move randomly one at a time, and on the front panel the user can see a hand and the finger will get dark when corresponding servo motor moves (attached file: hand). 

 

I created classes for the controls (fingers), one for the queue (which are the random numbers 1-5 which represent fingers) and one for the visa serial connection (see attached file: project explorer and block diagram). The class for the visa serial is the one in yellow. I created three VI from dynamic dispatch templete (attached file: configure, servo touch and servo lift). 

 

The five controls (fingers) are in a cluster.

 

Arduino: 

I use: Serial.begin(115200);

From labview I send the command: nbr,ON (for servo touch) and nbr,OFF (for servo lift). But the arduino code has been working good before I changed to classes (so that shouldn't be any problem).

 

Problem: The servo motors sometimes move but not always, which they should do. They should also move in sync with the fingers on the front panel when they get darker. 

 

Do you know how I should do?

 

I didn't attach the program, because I have a lot of old subVIs I don't use so maybe it'll be more confusing than helping. So I hope the attached pictures helps. 

 

Let me know if there's something that I forgot to tell you that you need to know. 

 

Appreciate some help!

0 Kudos
Message 1 of 5
(3,015 Views)

 

Hi,

How often do the server motors not move?

Is it more regular on a particular finger?

How are you connecting the motors to the Arduino?

Is there a reason why the output of the VISA write function in not being re-bundled then passed into the VISA serial port out?

Kind regards,

Alex

0 Kudos
Message 2 of 5
(2,959 Views)

Hi Alex,

 

1. Now there are servo motors will activate ten times (two times on each). When I tried it, it moves 0-2 times.

2. What I can remember it is always on the same servo motor. 

3. I use arduino nano, and the servos are connected to D3, D5, D6, D9 and D10. But it has been working before I tried to implement classes. 

4. No, there's no reason. I was thinking that maybe I don't have to since it is in the private data of the class "Config Visa Serial". 

 

Best regards, 
Pamela

0 Kudos
Message 3 of 5
(2,948 Views)
Solution
Accepted by topic author 50616d656c61

Hi Pamela,

 

Maybe try re-bundling the output of the VISA Write Function, then pass it into the VISA Serial Port Out. See what happens, and let me know if anything different occurs.

 

Regards,

 

Alex

Message 4 of 5
(2,934 Views)

Yes, that seemed to be the problem. I thought I didn't have to do that because of the private data. 

 

Thank you, Alex!

0 Kudos
Message 5 of 5
(2,898 Views)