06-25-2019 05:20 AM
hi,
i am new in labview i am trying to send array from arduino and labview will read then after labview will increament the 0th index of array by 1 and send back to arduino i attatched my vi file there please tell me what i did wrong
Solved! Go to Solution.
06-25-2019 05:27 AM
Hello nidhi11,
Not everyone has the privilege to use the latest version.
Kindly save the vi for the previous version like LV2017 or LV2016
06-25-2019 06:06 AM - edited 06-25-2019 06:08 AM
hi kartiknattar
i don't know to how to convert but when i click file one option is the convert in old version that i converted see is it correct or not
06-25-2019 06:17 AM
Hi nidhi11,
You have converted the vi correctly.
You are incrementing the 0th element correctly. Kindly check if you are receiving the data from Arduino correctly (No. of bytes to read).
06-25-2019 06:40 AM
this is the arduino code
void setup() {
Serial.begin(9600);
}
int tbyte[5];
int rbyte[5];
void loop()
{
if(Serial.available()>0){
for(int i=0;i<5;i++)
{
Serial.write(tbyte[i]);
rbyte[i] =Serial.read()-'0';
Serial.println(rbyte[i]);
delay(500);
if(i>5)
break;
}
}
}
06-25-2019 07:22 AM
what is the problem that you are facing?
06-25-2019 07:28 AM
labview is not able to read the data and not sending also
06-25-2019 07:35 AM
Hi nidhi,
labview is not able to read the data
Don't use BytesAtPort!
Your Arduino is using Println(), so just read the serial buffer "line by line"…
and not sending also
Your Arduino code is not receiving anything, it is just sending data…
06-25-2019 07:43 AM
but in arduino i and using serial.read() function for read the data then how it is not recieving data
06-25-2019 07:45 AM - edited 06-25-2019 07:51 AM
Hi nidhi,
I'm sorry, I overlooked that Serial.Read() in your text above.
Can you verify in the Arduino IDE (and its debugger) you don't receive anything in the Arduino?
Do you get any errors in LabVIEW?
Serial.write(tbyte[i]); rbyte[i] =Serial.read()-'0'; Serial.println(rbyte[i]);
Your Arduino is sending one byte (without TermChar), then it wants to read something from the serial buffer, then it sends another byte now with TermChar.
Your LabVIEW code is trying to read some bytes, waiting for a TermChar or your "Byte count" input. Then it sends several bytes - as much as are in your "array out" indicator.
There may be some deadlocks because of both devices waiting for input from the other communication partner.
Usually the scheme is different:
What's the point of your "sending data back and forth"?