the arduino script is quite simple, as soon as a serial comes in, it starts blinking for 3 seconds.
when i test it with the serialmonitor from the arduino enviroment it works exactly as it should.
but when i tried it with the command line tool it does only work, when the "serial monitor" is activated in arduino application.
as soon as i turn of the serial monitor in the arduino application, i cant send commands anymore.
the LED blinks very short just once, but thats it.
Try writing something that just sends a string of characters from the Arduino to the serial port. Then see if the command line is picking it up. I suspect it won't because it is not initialising properly.
What system are you on?
i've tried with the script Spooky Arduino that sends the arduino a number, and blikes that often.
the arduino blinked just once but thats it. again, the same. when i opend the serial monitor in arduino 0013 application, the Spooky arduino script worked well.
I can only think that something is closing the com port on the other applications and by opening the serial monitor you are keeping that com port open.
I must admit that I have never had the serial monitor and something else talking to the serial port open at the same time, mainly because I assumed it wouldn't work. In practice it shouldn't work.
This is because of the resource conflict you will get. You could do things like this on early computers but not the operating system of today which take so much trouble to prevent you from doing it.
I think you'r on the wrong way to solve this,
You say the led is blinkin one short blink after eachtime you press enter on the command line?
that means it actually reaceives something so my guess why it won't work would be the serial speed not setted properlly on yourserial software..it must be the same as on the arduino(i guess you used 9600Bps). And i also guess that your led is plugged on something like 13 right?. if this is not the answer your looking for,send me a pm.
hi,
just wondering whether you have solved the problem in the meanwhile because I have the same trouble using pyserial when not running it from a python shell.
I can't figure out what is closing or opening the port exactly...
This is likely to be caused by the auto-reset again.
If you run e.g. a Perl script in a terminal to send some bytes to the arduino and then return, this will happen:
a) serial port is opened --> arduino gets an auto-reset (via state change of DTR line)
b) data is sent
c) serial port is closed
So if you don't wait long enough between a) and b) Perl will be talking to the bootloader.
If you keep the IDE's serial monitor open (listening), the serial port will not be closed and the DTR line will not change its state. So next time you can just send some data with the Perl script without resetting the board.
The same effect occurs if you e.g. kepp a serial port open on Linux with cat /dev/.... or tail /dev/....
You can also use "stty -F /dev/ttyS0 -hupcl" for the same effect.
I had a similar problem. I was using pyserial to connect to the board. When the program started the Duemilanove automatically resets but the code started transmitting before the board came back up so the first part of the transmission got dropped and then was off by a number of bytes for the everything else. The solution was just to sleep the python code for a second or two after initializing the serial part to ensure the board had sufficient time to restart.
I have the exact same problem and I'm using pyserial. I tried sleeping for a couple seconds but to no avail. Jgg, can you post some simple python code that worked?