Serial Communication of char from LilyPad to UNO

Hello everyone,
I'm having big problems figuring out how to send through a virtual serial port a simple char from a LilyPad to an Arduino Uno.
When I open the serial monitor i just see an infinite sequence of question marks.
What could be the problem?
Thanks a lot in advance.

Code in the LilyPad:

#include <SoftwareSerial.h>
char comm;

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

void loop() {  
     comm = 'a';
     Serial.write(comm);
  }

Code in the Arduino UNO:

#include <SoftwareSerial.h> 
#define SOFTRX 10
#define SOFTTX 11


SoftwareSerial SerialS(SOFTRX, SOFTTX);

char inbyte;

void setup() {  
  pinMode(SOFTTX, OUTPUT);
  pinMode(SOFTRX, INPUT);

  delay(3000);
  
  Serial.begin(19200);
  Serial.println("Ready to receive from Lilypad");
  
  SerialS.begin(19200);
}

void loop() {
  
  if (SerialS.available()>0)
  {
    inbyte=Serial.read();
    Serial.println(inbyte);
  }
 delay(10);
}

You have

Serial.begin(9600); 

on the LilyPad but

SerialS.begin(19200);

On the Uno, so the baud rates do not match

Then, to compound the problem you do this

  if (SerialS.available()>0)
  {
    inbyte=Serial.read();
    Serial.println(inbyte);
  }

so when a byte is available on the SoftwareSerial interface you read from the hardware Serial interface instead of the SoftwareSerial interface

Why did you #include SoftwareSerail.h on the LilyPad and then not use it ?

I used different baud rates because doing some testing before using int variables and
Serialprint(SerialSread()) it worked just with these rates and setting the serial monitor to 19200.

Now i tried changing everything to 9600 and using inbyte=SerialS.read() but still in the serial monitor I don't recive the char a, just "blank" spaces.

Did you fix the problem on the Uno where you check for available data on one serial interface and if it is present you read from a completely different one ?

@carlopenasa, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.