how to use 2 usb serial port at the same time on computer

I think you better try to explain what you like to accomplish with your project.
You want to read data with one UNO and sensor to the PC and then work this data in the pc and send it back to an other UNO.
Is there a real need to have 2 UNO's?
One UNO can read and send sensor data that is worked over in the PC.

Paco

backbone:
I think you better try to explain what you like to accomplish with your project.
You want to read data with one UNO and sensor to the PC and then work this data in the pc and send it back to an other UNO.
Is there a real need to have 2 UNO's?
One UNO can read and send sensor data that is worked over in the PC.

Paco

Thanks for your replied. now i own an ADXL345 Eval board with usb port built in.

Then i wish to use it to connect to my pc. and then i will connect arduino Uno to my pc at the same time also. Then i wish that arduino Uno can get the data from adxl eval board. This is the flow that i think:
ADXL345 eval board -> pc (USB serial port eg com port 21). Then pc -> arduino (USB serial port eg com port 22 ). Then how do i write in arduino code to include com port 21 for adxl eval board?

Each Arduino will read and write from it's own Serial port, and you'll need a small program running on the PC to transfer the data between the two.

dxw00d:
Each Arduino will read and write from it's own Serial port, and you'll need a small program running on the PC to transfer the data between the two.

this is the 1 i am looking for. can u guide me how??really appreciate that^^

There's not much to it. When a byte comes in on serial port a, write it to serial port b, and when a byte comes in on port b, write it to port a. The exact implementation would depend on what language you were using on the PC.

dxw00d:
There's not much to it. When a byte comes in on serial port a, write it to serial port b, and when a byte comes in on port b, write it to port a. The exact implementation would depend on what language you were using on the PC.

can i do like that??i have the concept like this also...because it is simplest way to do it. I am using windows, using arduino GUI. It is using C language right. any special library need to included? is it same as normal code to use void setup() and then void loop()?

can i do like that??i have the concept like this also...because it is simplest way to do it. I am using windows, using arduino GUI. It is using C language right. any special library need to included? is it same as normal code to use void setup() and then void loop()?

You can't write a PC application using the Arduino IDE.

PaulS:

can i do like that??i have the concept like this also...because it is simplest way to do it. I am using windows, using arduino GUI. It is using C language right. any special library need to included? is it same as normal code to use void setup() and then void loop()?

You can't write a PC application using the Arduino IDE.

then any others IDE that you can intro to me??

There are many to choose from. Processing is free, and has a very similar IDE. If you are a Windows user, then Visual C# express and Visual Basic express are also free. If you don't need a fancy gui, and it isn't necessary for this application, then the tiny c compiler would probably do.

dxw00d:
There are many to choose from. Processing is free, and has a very similar IDE. If you are a Windows user, then Visual C# express and Visual Basic express are also free. If you don't need a fancy gui, and it isn't necessary for this application, then the tiny c compiler would probably do.

Ok now i have netbean because i did JAVA project previously. So can i use netbean? and any example guide that you can show me so that i can refer to?regarding on how to communicate with multiple com port...i need some guide on the library and the C# code

i need some guide on the library

What library?

and the C# code

What C# code?

PaulS:

i need some guide on the library

What library?

and the C# code

What C# code?

mean if i use others IDE, then how i write the code for communicating between 2 com port?

It depends on what you use. Look at it's documentation for reading and writing serial data.

dxw00d:
It depends on what you use. Look at it's documentation for reading and writing serial data.

ok thanks..i will look on that. if anything, i will post here and ask again. Thanks all of you for kindness replied. Thanks so much^^ :slight_smile:

I fear you're on a far too complicated path!

your link about the Evaluation Board - ADXL345 says
" The UART pins are also broken out allowing a direct TTL interface with the processor. "

You just need two digital pins and GND from the Arduino and connect that directly to the ADXL uart. (Rx to Tx , Tx to Rx, GND to GND)
Then look for the Arduino SoftwareSerial Library, and hopefully you see it's all done, already.

The next task is you probably need to see on the PC what's going on,
so you might like to copy the communication (both sides) to the standard serial.println to log it in the PC Arduino Serial Monitor.

michael_x:
I fear you're on a far too complicated path!

your link about the Evaluation Board - ADXL345 says
" The UART pins are also broken out allowing a direct TTL interface with the processor. "

You just need two digital pins and GND from the Arduino and connect that directly to the ADXL uart. (Rx to Tx , Tx to Rx, GND to GND)
Then look for the Arduino SoftwareSerial Library, and hopefully you see it's all done, already.

The next task is you probably need to see on the PC what's going on,
so you might like to copy the communication (both sides) to the standard serial.println to log it in the PC Arduino Serial Monitor.

thanks for your advise. now honestly i have no exact idea on it. I try connect it with TX (from eval adxl board)to RX on arduino...i did print it on serial monitor but it seem llike displayed current value instead of the data i want....i am stuck on it now..

can any one help me for using 4 uart ports of atmega 2560 at a time

What help do you need?

If you are interesting in communication to two or more boards from the same pc, just should run different IDE-s of Arduino, not from file->... menu but from another arduino.exe, only in this case arduino allows to have different ports on different projects.