"SoftwareSerial.h" library in arduino UNO

Hello everyone, could someone help me with this?
I am using the "SoftwareSerial" library on an arduino UNO, I am using pins RX = 8 and TX = 4, the arduino sends, but does not receive data. Is there some configuration missing?

Thank you!.


#include <SoftwareSerial.h>
#define RXs 8
#define TXs 4
SoftwareSerial SerialSoft(RXs, TXs); // defino los pines RX, TX

byte caracter_tx;
byte caracter_rx;
byte flag_05s;

long conta;

///////////////////////////////////////////////////////////////////////////////////////////////////
void setup()
{
  pinMode(13, OUTPUT);
  pinMode(TXs, OUTPUT);
  pinMode(RXs, INPUT);

  SerialSoft.begin(9600);
  digitalWrite(13, LOW); 

  caracter_tx = 0;
  SerialSoft.print(caracter_tx);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
void loop()
{
  leer_serial();
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//este evento se activa cada vez que recibe un dato en el puerto
void leer_serial()
{
  
  if(SerialSoft.available() > 0)
  {
    caracter_rx = SerialSoft.read();

    if(caracter_rx == '0')
    {digitalWrite(13, LOW);}

  if(caracter_rx == '1')
    {digitalWrite(13, HIGH);}
  }
}
///////////////////////////////////////////////////////////////////////////////////////////////////

What is sending serial data to the Uno via SoftwareSerial ? How do you know that it is sending data ?

You do not need to set the pinMode() for the pins used by SoftwareSerial

Hi UKHeliBob, I'm testing with proteus

[View image] (Captura de pantalla 2023-01-04 224439.png - Google Drive)

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