I would like to use the USB to communicate with a simple serial terminal.
Which library should I use ?
Does anyone have a simple example I can hack please ?
byte incomingByte;
void setup(){
Serial.begin (9600);
}
void loop(){
if (Serial.available()>0){
incomingByte = Serial.read();
Serial.print(incomingByte);
}
}
Simple example to echo back any characters received.
Play with Serial.print statement to change format of returned text.
Thanks
Serial.begin (9600);
Is this the correct syntax for addressing the next port ?
Serial1.begin (9600);
For some reason I have been having trouble accessing that page today.
Arduino UNO has only one serial port (thus object), the Serial.
Arduino MEGA has four so Serial, Serial1,Serial2,Serial3.
Ok thanks,
So the language commands only refer to the uart and implementing software serial ports is done using the library ?
Sorry if this seems simple, most of my experience with serial is hardware orientated.
Only Serial.begin() works with the USB connector - on any arduino board.
Serial1,2,3 those are hardware serial ports for 1284P and 2560 chips.
Anything else uses software serial, and must used different names.
(I suppose you could do software serial via D0, D1, but why would you?)
Anything beside Serial.begin() also need hardware buffers (USB/Serial adapter, RS232, RS485, etc) if you want to do anything besides 0/5V (commonly called TTL) levels of data.