LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview, arduino compiler, TCP

Hi

I want to program my arduino with arduino compiler for Labview. I also have WiFi module. The TCP communication is working good. I attach VI's where on PC I send 3 doubles and arduino receive it, send back, PC read it and display it. What I want to do is sending commands for arduino, interpreting data send to arduino (calculations, etc.). How to do that? In arduino block responsible for reading data from serial puts out 1D array of U8. I don't know how to deal with it.

 

 

Download All
0 Kudos
Message 1 of 13
(4,079 Views)

Hi kubajed,

 

in your arduino.vi you are using some serial communication to transfer data.

The 1D array of U8 will contain whatever you sent to the Arduino using the serial comm line. As you should know which data you sent to your device you should also know how to parse/convert this array…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 13
(4,021 Views)

As you can see in "send receive pc.vi" I send double flatten to string. It doesn't matter in which way I convert received in arduino data, it always is wrong. I don't know how to do that. 

0 Kudos
Message 3 of 13
(4,003 Views)

Hi kubajed,

 

you should start with integers instead of floats - they are much easier to handle!

 

Did you notice the FlattenToString will prepend an arraysize before the actual DBL data? Does your Arduino count for that?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 13
(3,993 Views)

I don't know about it and arduino don't do that. Do you think that FlattenToString is good function for that case? What do you recommend if it isn't?

0 Kudos
Message 5 of 13
(3,988 Views)

Hi kubajed,

 

did you read the help for FlattenToString?

Did you read the explanations for all of its inputs? All of them???

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 13
(3,983 Views)

I read it again and I saw this input: prepend array or string size? There I can disable sending informations about size of data. But I notice another problem, this function generates specific string and I think that I am unable to read it on arduino. What do you think?

0 Kudos
Message 7 of 13
(3,973 Views)

Hi kubajed,

 

I don't know why you are unable to read a string on Arduino…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 13
(3,970 Views)

Could you show how to do that?

0 Kudos
Message 9 of 13
(3,968 Views)

Hi kubajed,

 

I don't know much about Arduino programming.

But I'm sure there are commands to read data from serial port (like "Serial.readln") and other commands to scan strings…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 13
(3,952 Views)