I've noticed that when the Serial Monitor button is pressed in the Arduino compiler, that it somehow sends a signal that resets the device so that it runs setup() and starts over.
I'm working on a computer program to work with my Uno and I'd like to know how to send this signal.
sparticus1701:
I've noticed that when the Serial Monitor button is pressed in the Arduino compiler, that it somehow sends a signal that resets the device so that it runs setup() and starts over.
I'm working on a computer program to work with my Uno and I'd like to know how to send this signal.
Simple, the DTR or the RTS comm port control signals are what the arduino uses to cause a auto-reset on the board thus starting the bootloader executing which listens for a little while to see if the arduino IDE is trying to upload a new sketch to the board and if not jumps to any sketch that might have already been loaded onto the board from a prior upload.
So if your PC application can 'talk' to a PC comm port and manipulate the DTR or RTS control signal that is all you need to force a reset on an attached arduino board.
Additional info: I'm using .NET's System.IO.Ports.SerialPort class for communication with the Uno. The class does have DtrEnable and RtsEnable properties. I'll post code once I get this working.
sparticus1701:
Additional info: I'm using .NET's System.IO.Ports.SerialPort class for communication with the Uno. The class does have DtrEnable and RtsEnable properties. I'll post code once I get this working.
Well a little more detail from me also. Originally on the first arduino boards that used an auto reset function the RTS signal is what they used to cause the reset condition. Later they started using the DTR signal on the arduino board, so the IDE now pulses both DTR and RTS so that both old and present boards will work. So most likely your arduino board will only respond to the DTR signal unless it's a very old one, so you may have no need to pulse RTS or both, just DTR. That make sense?