Pages: [1]   Go Down
Author Topic: serial data transfer between arduino uno and arduino micro  (Read 1364 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok this is what I have done:

It is exaclty the same other people have done but I do not know what I have done wrong:

Arduino UNO: TX--> RX of arduino micro
Arduino UNO: RX ---> TX of arduino micro.
common GND.

Code for arduino uno: (sender)

Code:
void setup()
{
 Serial.begin(9600);
}

void loop()  {
 
  //--- display the character just sent on console ---
  Serial.println( "Hello world" );
delay(1000);
  
}  

Code for receiver (micro):

Code:
void setup()
{
 Serial.begin(9600);

}

void loop()  {
 if (Serial.available() > 0) {
    int temp=Serial.read();
    Serial.println(temp);
 } else {
    Serial.println("Not available data");
 }
 delay(1000);
}

and I do see not available data.

What am I missing?

« Last Edit: January 08, 2013, 04:27:09 am by vima » Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Arduino UNO: TX--> RX of arduino micro
Arduino UNO: RX ---> TX of arduino micro.

and I do see not available data.

What am I missing?


What no Arduino Uno ground pin ---> ground pin of arduino micro?

The Rx and Tx signal lines only create electrical signals if there is a common ground circuit between the two boards.

Lefty
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yews sorry i have done this also. I forgot to mention it..

In both of the boards the TX led is blinking.
« Last Edit: January 08, 2013, 04:26:16 am by vima » Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Then I'm out of ideas. Software looks pretty basic and OK.

Lefty
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Then I'm out of ideas. Software looks pretty basic and OK.

Lefty


Try it with two Arduino Uno and it works. Does it mean that my micro is problematic or I missed something about micro that I should do?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 613
Posts: 49270
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Try it with two Arduino Uno and it works. Does it mean that my micro is problematic or I missed something about micro that I should do?
Yes, you have missed something. The Micro is like the Leonardo. The TX and RX pins are not connected to the Serial instance. They are connected to the Serial1 instance, which is separate from the USB-to-serial converter instance that Serial is connected to.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i connected to the pins 0-Tx, 1-Rx as shown in http://www.google.gr/imgres?imgurl=http://arduino.cc/en/uploads/Main/ArduinoMicro_pinout.png&imgrefurl=http://arduino.cc/en/Main/ArduinoBoardMicro&h=322&w=256&sz=39&tbnid=YaVYHo0WmFot9M:&tbnh=91&tbnw=72&zoom=1&usg=__8PNYmRdmUIQeCZqXA7yTceWVOag=&docid=JjYvdDtLKAQbDM&sa=X&ei=8RrsUO3xGu3M0AWD1YH4Aw&ved=0CDIQ9QEwAA&dur=765

What do you mean by Serial1? In my code i should
Code:
replace Serial.read() with Serial1.read()?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 613
Posts: 49270
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
In my code i should replace Serial.read() with Serial1.read()?
On the Micro, yes.
Logged

Pages: [1]   Go Up
Jump to: