Go Down

Topic: Detecting an arduino (Read 1 time) previous topic - next topic

Z

Is there a simple way to detect the presence of an arduino and which serial port it is connected to? If I export a sketch to an executable, the serial port is hard coded.

I thought about having the processing sketch send a message to every serial port and listen for a reply, but this doesnt seem particularly elegant.

MikMo

The (virtual) serial ports that Arduino create on the PC are only present when the Arduino board is actually plugged in. So if you have no other serial ports, you should be able to tell the presence of an Arduino board by the presence of the serial port.

robtillaart

#2
Jan 19, 2011, 10:05 pm Last Edit: Jan 19, 2011, 10:06 pm by robtillaart Reason: 1
@Z
What platform? Mac Linux Windows? Version?
what programming language you want to use?
What is your goal?

problem seems to be solved for C#
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1286854844/13
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Z

For reference: Windows (7)/Processing

I've constructed a program using processing which talks to the arduino, and Ideally I would export it as an executable that I could run on other computers besides my own.

The problem is that the total number of serial ports seems to vary in some manner im not aware of, and obviously the settings will vary if i use another computer.

I guess the question is, I am telling processing to look at a specific serial port in a sequence of serial ports (as in hey, look at the third port). Can I tell processing to look at a specific serial port instead (look at COM 7).

PaulS

Quote
Can I tell processing to look at a specific serial port instead (look at COM 7).

You could. The "list of serial ports" that you are indexing now is just a collection of strings. You could hardcode the name, instead.

But, my Arduino is not connected to COM7. So, you should not rely on specific port names.

Mac names and linux names are completely different.

Go Up