The USB port is used to upload the compiled "sketch" to the boards.
The function Serial.print() transmits data to the IDE, (monitor), on the PC.
But is it possible to send a "command", from the PC, using a separate program (NOT using the Arduino IDE), (i.e. an EXE) to the USB port, to receive and deal with some data from the adruino?
IE: compile program using arduino IDE, kill the IDE, connect PC to arduino, run an "exe" on the PC, send a command to the arduino, and the arduino to respond.
Thanks
Yes. The USB chip on your Arduino creates a virtual com port on your computer. You can communicate with the Arduino via this serial port using any program you like.
One thing that frequently causes problems for people doing this: On the Arduino boards without native USB (e.g. Uno, Mega, Pro Mini, Nano), when you open a serial connection the microcontroller resets. This is done because that serial connection is also used for uploading to the board and a reset is required to start the reset. If this auto-reset behavior is problematic for you, it is possible to disable it by putting a 10 uF capacitor between the reset and gnd pins on your Arduino or cutting the RST-EN jumper on the board but with the auto-reset disabled you'll need to manually reset the board at just the right time during the upload. You could also use a separate USB to TTL serial adapter, which are readily available for a reasonable price from most of the usual places you'd buy electronics.