.NET c# and arduino UNO problem

Hello ! I have a problem with my arduino Uno. If i start my program, an app i've created, gets the data okey from my arduino Uno, but if i unplug my arduino Uno my serialPort connection remains open . Even after i plug the device in again, the program can't write to my arduino. It's like my connection becomes frozen. With Arduino duemilanove i don't remeber having this problem . What I want is : when i disconnect my arduino Uno, my serialPort connection should close. Is there a reset on setup() or something like that ? Thanks

You want the Arduino to do something in you C# application when you unplug it? How?

You should be disconnecting the C# application from the serial port before unplugging the Arduino.

No. I am saying that when i unplug it, my serialPort connection remains open although with arduino duemilanove, my connection would close .

Did you check about the "error" event in the serial port? maybe you can close the port based on this event.

I think you can check this out on SO:

It might help achieving what you want. :slight_smile: