A beginner in Arduino programming here (learning Arduino programming while waiting for my board to arrive).
I am trying to understand how Arduino board is able do these two things using only one USB port it has:
- receive compiled code from a PC (from Arduino IDE: Sketch > Upload)
- serial communication between a PC application and the Arduino board (e.g. our own Windows application communicates with the Arduino board)
I just cannot wrap my mind around how does it distinguish between these two cases. I have used boards which have 2 USB ports: one is for programming (uploading your code) and the other one is for serial communication between any PC application and the board.
In my opinion there has to be some way for Arduino to detect when is it being flashed, and when is it being used as a regular serial port.