How I could detect programmatically if serial connection is available?
There is an obvious solution for this - like, make PC to send some response when serial bytes arrive, and detect this response wit Arduino program; I don't want to use this approach.
There might be also a possible solution with detecting power voltage, it looks rather unreliable and also requires some hardware arrangements.
QuoteThere is an obvious solution for this - like, make PC to send some response when serial bytes arrive, and detect this response with Arduino program; I don't want to use this approach. Why?
There is an obvious solution for this - like, make PC to send some response when serial bytes arrive, and detect this response with Arduino program; I don't want to use this approach.
There is nothing in the USB connection, if that is what you are thinking of, that defines whether the USB connector is receiving power only, or power and there is something on the other end of the serial port.
Is there any way to tell whether the Serial output buffer is full? I haven't looked into how it works, but I'm guessing there's some sort of FIFO within the Arduino runtime. That might offer a way to tell whether the Serial stream is actually moving.
If USB is connected this is enough for me to know the board is connected to PC and to start serial communications.
Yes it is.
Quote from: Stan09 on Jul 07, 2012, 05:42 amYes it is.So if USB is connected and your Arduino starts sending data, your PC will know what to do with it automatically?
Can you imaging a generic application that just listens to serial port and handles data regardless of what device is sending it?
Be reasonable, he's trying to help you. Detecting the presence of power is no guarantee that the PC is running the application you want. Also the buffer doesn't fill up just because there is no program at the other end reading it.You haven't answered the reasonable question: why not send a message to the Arduino to tell it so start transmitting? That is the reliable way. Of course you need to send another message to tell it to stop later.PaulS has a high post count because he helps a lot of people. Some aren't very helpful back. For example, they ignore his questions.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16