mrtweaver

Arduino com port detect disconnect

1 post in this topic

There is a posting on here that i made where one can download my code that i am currently using, so i am not going to repost it.

But i do have a question, i have the PC connected to that Arduino, and well out on the production floor where some of the units are, there is a chance, and it has happened where people have tripped over the USB cables that connect the Arduino to the PC, in some cases they also like to be trouble makers and disconnect the plug. If we catch them they get written up.

Anyway my question of the day is as follows, is there an easy way using COMMMG and ARDUINO includes, that one can keep an eye on the port and if the communication stops have the application do some event?

I have tried doing it with COMGETPORTS and COMPORTCONNECTION, and while both ways that i have come up with will detect when the USB Arduino is connected, it will not detect when the cable is unplugged.

It seems once you use the connecta command in the Arduino include it does not release the port. But I could be wrong in my guessing.

Still rather new to the programming.

Any script help greatly appreciated.

 

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now