Serial Program Issue

I'm very new to programming in general and I was wondering if anyone can see the error in my code. It compiles and uploads fine, and works perfect with the built in serial monitor. The issue begins when I start using another program to send characters to the arduino. It will work for about 3 or 4 seconds and then it loses connection to the program but is still visible in device manager. When I try going back into the arduino IDE the arduino is visible and says that it is being used by another program but I ended the program that would be using it. Any help would be greatly appreciated.

but I ended the program that would be using it.

Did doing that correctly close the serial port? I have my doubts.

Did doing that correctly close the serial port? I have my doubts.

Yes, I ended the program correctly. The issue goes away when I unplug the arduino and plug it back in, then i am able to upload again.

What language is the PC program written in?

If it is not too long post a copy of the PC code - use code tags - rather than uploading a picture.

...R

What language is the PC program written in?

It is National Instruments Vision Builder for Automated Inspection

garciadan92:

What language is the PC program written in?

It is National Instruments Vision Builder for Automated Inspection

I guess I left myself wide open for that one :slight_smile:

I have no idea what it is, and I suspect there will be few (if any) people here who do.

It sounds like what you do in the Serial Monitor is not identical to the NIVBAI. Have you some way to view what the NIVBAI is sending? Perhaps you can redirect the output to a file?

Or perhaps the NIVBAI expects some specific response that it is not getting. Have you the programming or interface specifications for NIVBAI?

What sort of Arduino are you using? If you have a Mega you could connect the NIVBAI to one serial port and, using an FTDI USB/TTL cable connect another serial port to the serial monitor. Then you could write a sketch that echoed the NIVBAI stuff to the serial monitor. You may be able to do this on a Uno using softwareSerial.

…R