how to code the UART so that i will not use Software serial ....................

Im using the Arduino Mega ADK, im planning to use the UART in a sketch , i dont know what im going to do .. please help :frowning:

thanks

ania:
Im using the Arduino Mega ADK, im planning to use the UART in a sketch , i dont know what im going to do .. please help :frowning:
thanks

Your question is vague, to say the least.
What do you mean?

ania:
i dont know what im going to do

Without a lot more information neither do I.

...R

i dont know what im going to do

Well, I read your post, and I do.

Im using the Arduino Mega ADK, im planning to use the UART in a sketch

So, what's stopping you?

Are you saying that Serial/Serial1/Serial2/Serial3 on the Mega aren't adequate for what you need? What "Mega"
do you mean anyway?

ania:
Im using the Arduino Mega ADK, im planning to use the UART in a sketch , i dont know what im going to do .. please help :frowning:

The MEGA ADK is based on the Atmega2560, so you not only can use the first Serial
Serial.begin(9600);
but you can use three additional hardware UARTs as easy as the first one:
Serial1.begin(9600);
Serial2.begin(9600);
Serial3.begin(9600);

how to use those Serial on the sketch/program without using the #include SoftwareSerial? thanks

thanks guys for your responds ...

[code]



#include <SoftwareSerial.h>// import the serial library

SoftwareSerial Genotronex(10, 11); // RX, TX

[/code]

what im going to do if i will use the Serial1, Serial2, in the program .. kindly explain or demonstrate it how it looks like when i use the Serial1, ect. ..

If you don't want to use "SoftwareSerial", you don't need to include it's library.
You don't need to add any libraries for hardware serial.

For instance, to use 'Serial1' at 9600 baud, all you need to do is type this line in 'setup()':-

Serial1.begin(9600);

and then you're good to go.

To print "Hello World" to the serial monitor, you would use:-

Serial1.println("Hello World");

Is this what you wanted to know?
For a lot more info on serial, check in the Arduino IDE under >Help >Reference "Serial".
There's a full list of functions, and clicking on each will give you more detailed information.

thank you so much.. God bless :)))

ania:
thank you so much.. God bless :)))

No problem. Hopefully that will get you started. :slight_smile:

For serial input from the serial monitor or from other sources to the Arduino, I recommend reading this very good basic tutorial by Robin2 as well:- Serial Input Basics

OldSteve:
No problem. Hopefully that will get you started. :slight_smile:

For serial input from the serial monitor or from other sources to the Arduino, I recommend reading this very good basic tutorial by Robin2 as well:- Serial Input Basics

thanks ..I appreciate you :slight_smile: GOD BLESS ..

To print "Hello World" to the serial monitor, you would use:-

Serial1.println("Hello World");

I don't have a Mega, but I would be surprised if that worked.

Am I right to be surprised ?

UKHeliBob:
I don't have a Mega, but I would be surprised if that worked.

Am I right to be surprised ?

Yes. Should have been "Serial" shouldn't it? :frowning:
(I said "serial monitor" without thinking.) (I don't have a Mega either.)

Ania, to print to the serial monitor, try this in 'setup()' instead:-

Serial.begin(9600);

then this:-

Serial.println("Hello World");

Sorry. Serial1, Serial2 and Serial3 print to other hardware serial ports, but not to the serial monitor.

The output from and input to Serial1, Serial2 and Serial3 on a Mega happens on the pins marked Tx1, Rx1 Tx2,Rx2 and Tx3,Rx3

You also need a GND connection to any device connected to those pins.

...R

Robin2:
The output from and input to Serial1, Serial2 and Serial3 on a Mega happens on the pins marked Tx1, Rx1 Tx2,Rx2 and Tx3,Rx3

You also need a GND connection to any device connected to those pins.

...R

hi thanks for your reply .. by the way what do you mean

"You also need a GND connection to any device connected to those pins" ?

ania:
hi thanks for your reply .. by the way what do you mean

"You also need a GND connection to any device connected to those pins" ?

When communicating with another device, you need to connect Arduino TX to the other device's RX, Arduino RX to the other device's TX, and also the Arduino ground must be connected to the other device's ground.

OldSteve:
When communicating with another device, you need to connect Arduino TX to the other device's RX, Arduino RX to the other device's TX, and also the Arduino ground must be connected to the other device's ground.

THANK YOU SO MUCH AGAIN AND AGAIN .. GOD BLESS YOU :slight_smile: