I had heard / read about a "serial terminal" window in the Arduino IDE, but what I read left a lot to be desired - how to make it work, is it done automagically, etc. So, (if I am understanding all this correctly), unless I "do something different" - whatever that is - any requests, via sketches software, hardware, or whatever, to use a "serial terminal", (using the built-in serial libraries?), automagically get routed through the USB interface to the IDE's serial terminal window. Right?
Not exactly. Please review the following sketch (It is in Examples\Basics in the IDE) and tell me what you see.
/*
AnalogReadSerial
Reads an analog input on pin 0, prints the result to the serial monitor.
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
This example code is in the public domain.
*/
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
While we're on this topic. . . (a bit off-topic, I apologize) . . . I just noticed on both my Uno and Mega boards that there are two pin-connections labeled "TX" and "RX", (on the Uno), "TX-0" and "RX-0", (on the Mega). (I had my Uno hidden under a Seeed servo/DC Motor shield - so I did not really notice this until now.) Do these run "in parallel" with the USB "serial" interface, or are they programmatically different?
Example: I have a 16x2 serial display board that I bought with the other Arduino "toys" I picked up for myself. It would be interesting to send, (at least), some status/display information to that display while the Ethernet board, (or some other shield, for that matter), is running.
Yes, you have a TTL/UART communication on the UNO and four on the MEGA. For the MEGA, you will address Serial, Serial1, Serial2 and Serial3 for the individual UARTs. Technically speaking, the UNO or MEGA's USB Serial is it's own UART via the Atmega8u2/16u2, but it uses the Serial (Rx0/Tx0) of the Mega or Uno to put things out through the USB via the Transistor to Transistor Level communication.
Clear as mud? Just start with some sketches, mess with some of the parameters and admit you are an Arduino noob
We all were in the beginning.