two arduinos communicating together??

how can I connect two arduinos using the rx/tx? is ther a schematic? sketch? don't where to start or how hook anything together? to build something like this?

The first problem in this lab is to get two Freeduinos to communicate with each other that are at least 2 feet apart. Freeduino 1 will have a set of switches to enter the correct bit pattern as well as LED’s to indicate the bit pattern that is applied to the Freeduino. Freeduino 2 will have LED’s that show the bit pattern output. Don’t forget to limit the output current to the LED’s. RS-232 protocol could help. The media over which they will communicate is up to 2 wires. Ground and a TX/RX data line. Special dispensation can be obtained by the lab dictator if another wire is needed. Explain why it is needed. You will need to partner with another person in lab because 2 Freeduinos will be required to communicate back and forth. We should be able to see the data transfer on the O’scope. The data inputs on Freeduino 1 must be replicated by Freeduino 2. If the bit pattern on the transmitting Freeduino is on, off, off, on, then the second Freeduino must replicate that pattern.

In section two of this lab the inputs and outputs will now become I/O that is controlled by the RX/TX pin. You may now use 3 wires, Ground, TX data, RX Data. Another wire can be approved if necessary. You are to make the Freeduinos able to talk back and forth. Either should be able to transmit its data to the other. The RX/TX pin is the key to making one Freeduino the TX and the other Freeduino the RX. Both Freeduinos should have switches and LEDs for input or output.

how can I connect two arduinos using the rx/tx? is ther a schematic? sketch? don't where to start or how hook anything together? to build something like this?

The first problem in this lab is to get two Freeduinos to communicate with each other that are at least 2 feet apart. Freeduino 1 will have a set of switches to enter the correct bit pattern as well as LED’s to indicate the bit pattern that is applied to the Freeduino. Freeduino 2 will have LED’s that show the bit pattern output. Don’t forget to limit the output current to the LED’s. RS-232 protocol could help. The media over which they will communicate is up to 2 wires. Ground and a TX/RX data line. Special dispensation can be obtained by the lab dictator if another wire is needed. Explain why it is needed. You will need to partner with another person in lab because 2 Freeduinos will be required to communicate back and forth. We should be able to see the data transfer on the O’scope. The data inputs on Freeduino 1 must be replicated by Freeduino 2. If the bit pattern on the transmitting Freeduino is on, off, off, on, then the second Freeduino must replicate that pattern.

In section two of this lab the inputs and outputs will now become I/O that is controlled by the RX/TX pin. You may now use 3 wires, Ground, TX data, RX Data. Another wire can be approved if necessary. You are to make the Freeduinos able to talk back and forth. Either should be able to transmit its data to the other. The RX/TX pin is the key to making one Freeduino the TX and the other Freeduino the RX. Both Freeduinos should have switches and LEDs for input or output.

There are three main hardware communication busses on the Arduino:

UART (or Serial or TTL level RS-232) - Full duplex (Data goes back and forth simultaneously) 10kb/s I2C (or Two-wire interface) - Half-duplex, ~23kb/s SPI (or Three wire interface) - Full-duplex, 1mbps

Your assignment sounds like it requires you to use the UART. There is one hardware UART on the Arduino, and the place to look is the Serial class in Arduino documentation. Connect the RX of one to the TX of the other. Be warned though that if your Freeduinos are communicating, you will not be able to program them. You can use the SoftwareSerial library to work around that issue.

You must connect the grounds of the two boards together as well.

Stick to one forum. Don't crosspost.

This forum seems like a more appropriate place to ask than the other thread you started.

It's obviously a school project and you're obviously expected to do the work yourself. Did your tutor say it was OK to go to a tech forum and ask somebody to design the solution for you?

YES!! he told us to find how to figure this and could get help from anywhere!! I have to explain the codes and lines to him and show how it works!! i just dont know where to start!!

where can I find some sort of a tutorial to get started? i really dont know where to begin?

There are plenty. What's the problem? I.e., what don't you understand?

So get two arduinos, connect Rx on one to Tx on the other, and vice versa for the second part, and connect the grounds.

Start with a simple sketch and go from there. Use the Reference page and the Learning page http://arduino.cc/en/Reference/HomePage http://arduino.cc/en/Tutorial/HomePage to understand what is being done.

byte LEDpin 13; 
byte inputdata;
void setup()
{
pinMode (LEDpin, OUTPUT);
Serial.begin(9600);
}
void loop()
{
Serial.write (1);

if (Serial.available()>0)
{
inputdata = Serial.read();
digitalWrite (LEDpin, HIGH);
delay (250);
digitalWrite (LEDpin, LOW);
}

} // end loop

""So get two arduinos, connect Rx on one to Tx on the other, and vice versa for the second part, and connect the grounds.""

hey thanks so do i upload the sketch to both arduinos? and then connect them together? using the rx/tx? so one arduino will send data to the other? so if do a sketch to send binary data to second arduino I should see led's light up as inputs and should see the result in second arduino as outputs? so many tutorials outhere I just can't find one that will really help with this particular setup? thanks

Yes. Yes. Yes. No. This simple sketch will simply light up the onboard LED for 1/4 second if any serial data is received. Make that part work, then start adding in reading of buttons, and changing the message that is sent with info on the button that was pressed, and decoding the message that was sent to light up an LED. On the input side, turn on the internal pullup resistors and use a switch to connect the input pin to ground, read the pin and act when a low is seen. On the output side, connect one side of a 470 ohm resistor to 5V, the other side to the anode of an LED, and the cathode of the LED to an output pin. When the output goes low the LED will turn on.

""Yes. Yes. Yes. No. This simple sketch will simply light up the onboard LED for 1/4 second if any serial data is received. Make that part work, then start adding in reading of buttons, and changing the message that is sent with info on the button that was pressed, and decoding the message that was sent to light up an LED. On the input side, turn on the internal pullup resistors and use a switch to connect the input pin to ground, read the pin and act when a low is seen. On the output side, connect one side of a 470 ohm resistor to 5V, the other side to the anode of an LED, and the cathode of the LED to an output pin. When the output goes low the LED will turn on.""

so what would a very simple sketch to have the arduinos do this? I really don't know what libraries to use? wire or softserial or master/slave?

CrossRoads: So get two arduinos, connect Rx on one to Tx on the other, and vice versa for the second part, and connect the grounds.

Start with a simple sketch and go from there. Use the Reference page and the Learning page http://arduino.cc/en/Reference/HomePage http://arduino.cc/en/Tutorial/HomePage to understand what is being done.

byte LEDpin 13; 
byte inputdata;
void setup()
{
pinMode (LEDpin, OUTPUT);
Serial.begin(9600);
}
void loop()
{
Serial.write (1);

if (Serial.available()>0) { inputdata = Serial.read(); digitalWrite (LEDpin, HIGH); delay (250); digitalWrite (LEDpin, LOW); }

} // end loop

I tried to upload this to the arduino and it gave an errror? expected initiliazer before numeric constant?

byte LEDpin 13;

Missing an equal sign!

All part of the learning process - can't trust everything one pull's off the internet 8)

SirNickity: There are plenty. What's the problem? I.e., what don't you understand?

I don't how to have both arduinos communicate? don't know what libraries to use?(wire,softserial,newserial, or master/ slave?

Serial.begin(9600); // the only library you need.

CrossRoads: Serial.begin(9600); // the only library you need.

ok so how can I write a sketch that; say I have led13 on and on my main arduino and second arduino reads if its on or off? or how can I turn the ledpin13 on or of using a switch? gives 1 or 0 on my monitor and the second arduino reads that?

anthony8i: ok so how can I write a sketch that; say I have led13 on and on my main arduino and second arduino reads if its on or off? or how can I turn the ledpin13 on or of using a switch? gives 1 or 0 on my monitor and the second arduino reads that?

So say you have a switch hooked up to your master and want that to control an LED on the slave. First hookup the RX/TX lines and ground as previously stated

On your master, read the state of the button. Send that data across the serial line. (You get the opportunity to write your own protocol!). On your slave, read any data from the Serial line and if it matches your protocol, then set the LED's state based on the data you received.