LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial.flush(); doesn't work

It looks like the current LIFA download still uses the Serial.flush(); to clear the input data buffer. As of Arduino 1.0 this command no longer clears the input buffer, but instead waits for output transmission to complete.

If you get a corrupt byte in the input buffer to the arduino somehow, the LIFA code will no longer clear the buffer to wait for the next command, so the Labview interface will stop working completely until you reset the arduino.

Can we please get this fixed in the LIFA code?

In the mean time, I replaced "Serial.flush();" with "while (Serial.read() != -1);" everywhere I could in the LabVIEWInterface code section. This seems to have worked for now.

0 Kudos
Message 1 of 4
(6,562 Views)

Sammy mentioned this issue back in 2012 so I figured it had been fixed.

0 Kudos
Message 2 of 4
(4,486 Views)

The most recent LIFA version I downloaded for Labview 2013 with the VI package manager still makes use of Serial.flush() in the Arduino firmware program...

0 Kudos
Message 3 of 4
(4,486 Views)

Hey ArrowFlinger,

You are correct that the problem still exits in the current version of LIFA.  The work around you suggested is probably the fix I'd go with, however I don't plan on updating the LIFA firmware since LIFA will be replaced with LINX in the very near future.

The real problem here is that everyone is expected to build the firmware from source and Arduino changes their API whenever they feel like it with no concern for backwards compatability.  LINX will still ship with the firmware source but will also include pre-build hex files and a nice wizard interface to deploy them to your LINX device of choice.

LINX is currently in closed Beta but I hope to have a 1.0 release in the near future.  For now PM me if you're interested in joining the LINX beta group.

Thanks,

-Sam K

LabVIEW Hacker

Join / Follow the LabVIEW Hacker Group on google+

0 Kudos
Message 4 of 4
(4,486 Views)