07-21-2017 10:52 PM
I don't want to use LINX.Because it creates problem to run other codes on the same device (i.e. Arduino UNO/MEGA). As I mentioned before, I will use this HC-SR04 code as a subVI in my main code.
07-24-2017 02:24 AM
Mr. GerdW
Would you help me to convert the Arduino code (attached) into LabView code?
Thanks in Advance...
07-24-2017 09:46 AM
Well what you have now is a time out error. This is determined by the timeout input to the VISA configure serial port.vi and is defaulted to 10 seconds.
This vi you are using is setup to stop or loop on one of 3 conditions:
A) the visa read.vi receives 500 bytes
B) the visa read.vi does not see 500 bytes or a new line character (/n) after 10 seconds in which case it will error.
C) the visa read.vi receives a new line character (/n) which basically tells the vi that the message is complete. It will then loop and start over reading. This new line character is sent by the arduino and in this case by the second to last line; Serial.print ("/n");
I'm not sure how well the arduino IDE releases the COM port but you could try using the arduino ide serial monitor (without the vi running) to confirm the Uno is working properly. Then close the serial monitor and selecting the same COM port start your vi.