Skip to main content
added code, corrected char() issue
Source Link

uno code Uno code

mega code

#include <SoftwareSerial.h>

#define rxPin 10
#define txPin 11

SoftwareSerial s(rxPin, txPin);

String buff = "";

void setup()
{
    s.begin(9600);
    Serial.begin(9600);
}

void loop()
{
    if(Serial.available)
    {
        while(Serial.available())
        {
            buff += char(Serial.read());
        }
        s.print(buff);
        buff="";
    }
    
    if(s.available)
    {
        while(s.available())
        {
            buff += char(s.read());
        }
        Serial.print(buff);
        buff = "";
    }
}

replace Serial.read(); by char(Serial.read()); and it should work Mega code

String buff = "";

void setup()
{
    Serial1.begin(9600);
    Serial.begin(9600);
}

void loop()
{
    if(Serial.available)
    {
        while(Serial.available())
        {
            buff += char(Serial.read());
        }
        Serial1.print(buff);
        buff="";
    }
    
    if(Serial1.available)
    {
        while(Serial1.available())
        {
            buff += char(Serial1.read());
        }
        Serial.print(buff);
        buff = "";
    }
}

Did you double check your connections ? Tx (mega) to rx (uno) and rx (mega) to tx(uno)

uno code

mega code

replace Serial.read(); by char(Serial.read()); and it should work

Did you check your connections ? Tx (mega) to rx (uno) and rx (mega) to tx(uno)

Uno code

#include <SoftwareSerial.h>

#define rxPin 10
#define txPin 11

SoftwareSerial s(rxPin, txPin);

String buff = "";

void setup()
{
    s.begin(9600);
    Serial.begin(9600);
}

void loop()
{
    if(Serial.available)
    {
        while(Serial.available())
        {
            buff += char(Serial.read());
        }
        s.print(buff);
        buff="";
    }
    
    if(s.available)
    {
        while(s.available())
        {
            buff += char(s.read());
        }
        Serial.print(buff);
        buff = "";
    }
}

Mega code

String buff = "";

void setup()
{
    Serial1.begin(9600);
    Serial.begin(9600);
}

void loop()
{
    if(Serial.available)
    {
        while(Serial.available())
        {
            buff += char(Serial.read());
        }
        Serial1.print(buff);
        buff="";
    }
    
    if(Serial1.available)
    {
        while(Serial1.available())
        {
            buff += char(Serial1.read());
        }
        Serial.print(buff);
        buff = "";
    }
}

Did you double check your connections ? Tx (mega) to rx (uno) and rx (mega) to tx(uno)

added 49 characters in body
Source Link

My answer might not be what you'd expect but I'll try anyway.

Did you troobleshoot your serial communications ? Try doing a simple programm for both cards and try sending data from one to another.

uno code (not tested)

mega code (not tested)

replace Serial.read(); by char(Serial.read()); and it should work

Did you check your connections ? Tx (mega) to rx (uno) and rx (mega) to tx(uno)

In your setup() on your arduino mega

void setup()
{
  Serial.begin(9600);
  lcd.begin(16,2);
  pinMode(22,INPUT_PULLUP); // Reed switch - Row1
  pinMode(24,INPUT_PULLUP); // Reed switch - Row2
  pinMode(26,INPUT_PULLUP); // Reed switch - Row3
  pinMode(28,INPUT_PULLUP); // Reed switch - Row4
  pinMode(30,INPUT_PULLUP); // Reed switch - Row5 
  pinMode(32,INPUT_PULLUP); // Reed switch - Row6 
  pinMode(34,INPUT_PULLUP); // Reed switch - Row7 
  pinMode(36,INPUT_PULLUP); // Reed switch - Row8 
  pinMode(2,INPUT_PULLUP);// Push Button
  pinMode(38,OUTPUT);
  pinMode(40,OUTPUT);
  pinMode(42,OUTPUT);
  pinMode(44,OUTPUT);
  pinMode(46,OUTPUT);
  pinMode(48,OUTPUT);
  pinMode(50,OUTPUT);
  pinMode(52,OUTPUT);
  pinMode(3,OUTPUT);
  digitalWrite(38,HIGH);
  digitalWrite(40,HIGH);
  digitalWrite(42,HIGH);
  digitalWrite(44,HIGH);
  digitalWrite(46,HIGH);
  digitalWrite(48,HIGH);
  digitalWrite(50,HIGH);
  digitalWrite(52,HIGH);
  digitalWrite(3,LOW);
}

I don't see the Serial1.begin(9600) as said by @chrisl but you mentionned it above.

I hope this helps, sorry if I've not solved your problem.

My answer might not be what you'd expect but I'll try anyway.

Did you troobleshoot your serial communications ? Try doing a simple programm for both cards and try sending data from one to another.

uno code (not tested)

mega code (not tested)

Did you check your connections ? Tx (mega) to rx (uno) and rx (mega) to tx(uno)

In your setup() on your arduino mega

void setup()
{
  Serial.begin(9600);
  lcd.begin(16,2);
  pinMode(22,INPUT_PULLUP); // Reed switch - Row1
  pinMode(24,INPUT_PULLUP); // Reed switch - Row2
  pinMode(26,INPUT_PULLUP); // Reed switch - Row3
  pinMode(28,INPUT_PULLUP); // Reed switch - Row4
  pinMode(30,INPUT_PULLUP); // Reed switch - Row5 
  pinMode(32,INPUT_PULLUP); // Reed switch - Row6 
  pinMode(34,INPUT_PULLUP); // Reed switch - Row7 
  pinMode(36,INPUT_PULLUP); // Reed switch - Row8 
  pinMode(2,INPUT_PULLUP);// Push Button
  pinMode(38,OUTPUT);
  pinMode(40,OUTPUT);
  pinMode(42,OUTPUT);
  pinMode(44,OUTPUT);
  pinMode(46,OUTPUT);
  pinMode(48,OUTPUT);
  pinMode(50,OUTPUT);
  pinMode(52,OUTPUT);
  pinMode(3,OUTPUT);
  digitalWrite(38,HIGH);
  digitalWrite(40,HIGH);
  digitalWrite(42,HIGH);
  digitalWrite(44,HIGH);
  digitalWrite(46,HIGH);
  digitalWrite(48,HIGH);
  digitalWrite(50,HIGH);
  digitalWrite(52,HIGH);
  digitalWrite(3,LOW);
}

I don't see the Serial1.begin(9600) as said by @chrisl but you mentionned it above.

I hope this helps, sorry if I've not solved your problem.

My answer might not be what you'd expect but I'll try anyway.

Did you troobleshoot your serial communications ? Try doing a simple programm for both cards and try sending data from one to another.

uno code

mega code

replace Serial.read(); by char(Serial.read()); and it should work

Did you check your connections ? Tx (mega) to rx (uno) and rx (mega) to tx(uno)

In your setup() on your arduino mega

void setup()
{
  Serial.begin(9600);
  lcd.begin(16,2);
  pinMode(22,INPUT_PULLUP); // Reed switch - Row1
  pinMode(24,INPUT_PULLUP); // Reed switch - Row2
  pinMode(26,INPUT_PULLUP); // Reed switch - Row3
  pinMode(28,INPUT_PULLUP); // Reed switch - Row4
  pinMode(30,INPUT_PULLUP); // Reed switch - Row5 
  pinMode(32,INPUT_PULLUP); // Reed switch - Row6 
  pinMode(34,INPUT_PULLUP); // Reed switch - Row7 
  pinMode(36,INPUT_PULLUP); // Reed switch - Row8 
  pinMode(2,INPUT_PULLUP);// Push Button
  pinMode(38,OUTPUT);
  pinMode(40,OUTPUT);
  pinMode(42,OUTPUT);
  pinMode(44,OUTPUT);
  pinMode(46,OUTPUT);
  pinMode(48,OUTPUT);
  pinMode(50,OUTPUT);
  pinMode(52,OUTPUT);
  pinMode(3,OUTPUT);
  digitalWrite(38,HIGH);
  digitalWrite(40,HIGH);
  digitalWrite(42,HIGH);
  digitalWrite(44,HIGH);
  digitalWrite(46,HIGH);
  digitalWrite(48,HIGH);
  digitalWrite(50,HIGH);
  digitalWrite(52,HIGH);
  digitalWrite(3,LOW);
}

I don't see the Serial1.begin(9600) as said by @chrisl but you mentionned it above.

I hope this helps, sorry if I've not solved your problem.

added 19 characters in body
Source Link

My answer might not be what you'd expect but I'll try anyway.

Did you troobleshoot your serial communications ? Try doing a simple programm for both cards and try sending data from one to another.

uno code (not tested)

mega code (not tested)

Did you check your connections ? Tx (mega) to rx (uno) and rx (mega) to tx(uno)

In your setup() on your arduino mega

void setup()
{
  Serial.begin(9600);
  lcd.begin(16,2);
  pinMode(22,INPUT_PULLUP); // Reed switch - Row1
  pinMode(24,INPUT_PULLUP); // Reed switch - Row2
  pinMode(26,INPUT_PULLUP); // Reed switch - Row3
  pinMode(28,INPUT_PULLUP); // Reed switch - Row4
  pinMode(30,INPUT_PULLUP); // Reed switch - Row5 
  pinMode(32,INPUT_PULLUP); // Reed switch - Row6 
  pinMode(34,INPUT_PULLUP); // Reed switch - Row7 
  pinMode(36,INPUT_PULLUP); // Reed switch - Row8 
  pinMode(2,INPUT_PULLUP);// Push Button
  pinMode(38,OUTPUT);
  pinMode(40,OUTPUT);
  pinMode(42,OUTPUT);
  pinMode(44,OUTPUT);
  pinMode(46,OUTPUT);
  pinMode(48,OUTPUT);
  pinMode(50,OUTPUT);
  pinMode(52,OUTPUT);
  pinMode(3,OUTPUT);
  digitalWrite(38,HIGH);
  digitalWrite(40,HIGH);
  digitalWrite(42,HIGH);
  digitalWrite(44,HIGH);
  digitalWrite(46,HIGH);
  digitalWrite(48,HIGH);
  digitalWrite(50,HIGH);
  digitalWrite(52,HIGH);
  digitalWrite(3,LOW);
}

I don't see the Serial1.begin(9600) as said by @chrisl but you mentionned it above.

I hope this helps, sorry if I've not solved your problem.

My answer might not be what you'd expect but I'll try anyway.

Did you troobleshoot your serial communications ? Try doing a simple programm for both cards and try sending data from one to another.

uno code (not tested)

mega code (not tested)

Did you check your connections ? Tx (mega) to rx (uno) and rx (mega) to tx(uno)

In your setup() on your arduino mega

void setup()
{
  Serial.begin(9600);
  lcd.begin(16,2);
  pinMode(22,INPUT_PULLUP); // Reed switch - Row1
  pinMode(24,INPUT_PULLUP); // Reed switch - Row2
  pinMode(26,INPUT_PULLUP); // Reed switch - Row3
  pinMode(28,INPUT_PULLUP); // Reed switch - Row4
  pinMode(30,INPUT_PULLUP); // Reed switch - Row5 
  pinMode(32,INPUT_PULLUP); // Reed switch - Row6 
  pinMode(34,INPUT_PULLUP); // Reed switch - Row7 
  pinMode(36,INPUT_PULLUP); // Reed switch - Row8 
  pinMode(2,INPUT_PULLUP);// Push Button
  pinMode(38,OUTPUT);
  pinMode(40,OUTPUT);
  pinMode(42,OUTPUT);
  pinMode(44,OUTPUT);
  pinMode(46,OUTPUT);
  pinMode(48,OUTPUT);
  pinMode(50,OUTPUT);
  pinMode(52,OUTPUT);
  pinMode(3,OUTPUT);
  digitalWrite(38,HIGH);
  digitalWrite(40,HIGH);
  digitalWrite(42,HIGH);
  digitalWrite(44,HIGH);
  digitalWrite(46,HIGH);
  digitalWrite(48,HIGH);
  digitalWrite(50,HIGH);
  digitalWrite(52,HIGH);
  digitalWrite(3,LOW);
}

I don't see the Serial1.begin(9600) but you mentionned it above.

I hope this helps, sorry if I've not solved your problem.

My answer might not be what you'd expect but I'll try anyway.

Did you troobleshoot your serial communications ? Try doing a simple programm for both cards and try sending data from one to another.

uno code (not tested)

mega code (not tested)

Did you check your connections ? Tx (mega) to rx (uno) and rx (mega) to tx(uno)

In your setup() on your arduino mega

void setup()
{
  Serial.begin(9600);
  lcd.begin(16,2);
  pinMode(22,INPUT_PULLUP); // Reed switch - Row1
  pinMode(24,INPUT_PULLUP); // Reed switch - Row2
  pinMode(26,INPUT_PULLUP); // Reed switch - Row3
  pinMode(28,INPUT_PULLUP); // Reed switch - Row4
  pinMode(30,INPUT_PULLUP); // Reed switch - Row5 
  pinMode(32,INPUT_PULLUP); // Reed switch - Row6 
  pinMode(34,INPUT_PULLUP); // Reed switch - Row7 
  pinMode(36,INPUT_PULLUP); // Reed switch - Row8 
  pinMode(2,INPUT_PULLUP);// Push Button
  pinMode(38,OUTPUT);
  pinMode(40,OUTPUT);
  pinMode(42,OUTPUT);
  pinMode(44,OUTPUT);
  pinMode(46,OUTPUT);
  pinMode(48,OUTPUT);
  pinMode(50,OUTPUT);
  pinMode(52,OUTPUT);
  pinMode(3,OUTPUT);
  digitalWrite(38,HIGH);
  digitalWrite(40,HIGH);
  digitalWrite(42,HIGH);
  digitalWrite(44,HIGH);
  digitalWrite(46,HIGH);
  digitalWrite(48,HIGH);
  digitalWrite(50,HIGH);
  digitalWrite(52,HIGH);
  digitalWrite(3,LOW);
}

I don't see the Serial1.begin(9600) as said by @chrisl but you mentionned it above.

I hope this helps, sorry if I've not solved your problem.

added 119 characters in body
Source Link
Loading
Source Link
Loading