serial Connection only with "Serial Monitor" on

hi

i wanted to do something simple. when an terminal command line is executed, the arduino should blink for 3 seconds.

the command line i use is this http://todbot.com/blog/2006/12/06/arduino-serial-c-code-to-talk-to-arduino/

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.

any ideas?

It sounds like your terminal is not opening the correct COM port.

Make sure it is set up to open the same COM port as the USB is creating for you.

hm

i've copied the string from the arduino tools -> serial port menu. isnt this the port the usb is on?

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'm using Mac OS X 10.5.5, intel, arduino 0013.

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…

Hi jeah I have the same problem.... I would like to send data to arduino even if my Arduino software is off

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.

well I tried to do that

stty -f /dev/tty.usbserial-A6008cBY cs8 9600 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts -hupcl

But I sill get just one blink (reset I'm guessing). The thing is that it works OK with Matlab.

I don’t know.


Walt-Disneys-100-Years-Of-Magic-DVD-Boxset-DVDS
24 dvd boxset season 1-6

SPAM in last post.

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?

Not really what you are after, but I just updated the Cocoa Interfacing article at the Playground ( http://www.arduino.cc/playground/Interfacing/Cocoa#IOKit ).

Be aware that the IOKit example defaults to 250000baud; not 9600baud.

The Arduino library limits you to 1000000 baud, but 2000000 baud works well on the Duemilanove with the U2X setting.