Go Down

Topic: Sending a text between two Arduino (wired) (Read 771 times) previous topic - next topic

kawoonoon

Hi guys.

Can you please help me how to code and wire a project of mine.
It goes like this:
I type on the serial monitor of laptop1 and sends it to arduino1
and the arduino1 sends it to arduino2
and arduino2 sends it to laptop2 serial monitor.

Is there a way to possible do this? if not, then do you know a way how to send a message through arduinos?
Please help me.

HazardsMind

#1
Jan 14, 2013, 01:50 pm Last Edit: Jan 14, 2013, 01:59 pm by HazardsMind Reason: 1
Yea if you had 2 Arduino Megas
Edit, Yea you can use software serial.

I didn't have my coffee yet, so I'm not fully awake yet.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

tuxduino

Maybe software serial could be used instead.

MikMo

Or you could use softserial:

PC1 -> ordinary serial (USB) -> Arduino1 -> soft serial -> Arduino2 -> ordinary serial (USB) -> PC2

tuxduino

Have you considered I2C ? EasyTransfer is often cited as a very good library for that.

http://www.billporter.info/2011/05/30/easytransfer-arduino-library/

kawoonoon

Thanks for the fast reply and the help.. I'm gonna try this.

We just have 2 Arduino Uno R3. We are planning to put it on an LCD Screen on the later part but we are still having problems displaying it on Serial Monitor.

A question, does softwareserial can also send strings or characters?


>Yes we tried the easytransfer but it just blinks the led. can you tell me how to print the message sent from arduino1 to the serial port of laptop2?

tuxduino

So you've written some code, but it didn't work. My suggestion is then to post it.

kawoonoon

We tried using the wire examples: Arduino1 as the master writer and Arduino2 as the slave receiver.
as the exampled worked we got the hello looping on serial monitor of Arduino2 so we try to modify the program like this:

Code: [Select]

#include <Wire.h>
char rx_byte;
void setup()
{
  Wire.begin(); // join i2c bus (address optional for master)
 
}


void loop()
{
  Wire.beginTransmission(4); // transmit to device #4
  Wire.write(rx_byte);        // sends five bytes
  Wire.endTransmission();    // stop transmitting

  delay(500);
}



I don't know to much of the libraries function so I just fooled around with it.

EVP

You haven't assigned anything to rx_byte.

tuxduino

Fooling around with libraries is not the best way to produce working code.
A better option is to carefully read the library documentation and search for any additional information about the underlying protocol, if needed.
At that point one can come here with precise questions, and find help.

my 2 cents.

Go Up