Master data not responding when master analog pin grounded

Hello all,

Here's my master and slave code:

// MASTER - UNO CODE
#include <SoftwareSerial.h>
SoftwareSerial BTserial(0, 1); // RX | TX

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

}

void loop()
{
   if (Serial.available())
   {
    float val2 = map(analogRead(A0),0,1023,0,50);
    BTserial.write(val2);
    delay(1000);
   }
}

// SLAVE CODE

//NANO CODE
#include <SoftwareSerial.h>
SoftwareSerial BTserial(1, 0); // RX | TX

void setup()
{
   Serial.begin(9600);
   BTserial.begin(9600);
   Serial.println("hello");
}

void loop(){

   float val = map(analogRead(A0),0,1023,0,50);
   if (BTserial.available())
   {
    Serial.print((BTserial.read()));
    Serial.print(", ");
    Serial.print(val);
    Serial.println();
    delay(1000);
   }
   
}

When I ground the slave analog pin, the result is 0 as expected.
However, when I ground the master analog pin, the result is non-zero. Infact, the master data exceeds the limit of 50 when the pin is grounded when instead it should be zero.

I doubt something is wrong with the code.

What do you suggest?

Thanks for your time and help.

Then please post a wiring diagram.

posted above

Thanks, but next time don't edit your original post, add new information in a new post.

Don't the transceivers require power and ground connections? Do you have this problem with a simulation or real hardware?

Noted. Yes, I wired the BT to power and GND.

The problem isn't with the simulation (since HC05 in Proteus isn't able to wire themselves for some reason)
I don't know if the nano (master) not being able to ground its input, is due to code or hardware.

Have you tried a simple test sketch on the Master, that only reports the readings to the PC?

Yes, when I run the nano by itself, the output is as it should be and it grounds itself when it should be.

The problem is when I run the slave sketch to master and then ground the nano pin.

Whoa. Which one is master and which is slave? Also please clearly answer, do you have real hardware?

UNO is slave.
Nano is master.

Yes, I have real hardware.

What happens when you load master code on the slave, and slave code on the master?

Haven't tried that yet

I only did master on master and slave on slave

Why? It seems like a really obvious troubleshooting step.

As a note those are the programming pins of the Uno. Try use other pins for software serial.

I just tried. Yet, only one side is working

Yet, it's a big secret which side?

Yes, I am using Uno so shouldn't it be 0,1??

If I use other pin, what order should it be, and should the wiring go for tx-tx or rx-tx I currently have opposite ones?

This is from the slave code, which is implemented on the master (nano)

Break it down simply for me. Did the problem follow the code? The answer tells you whether you have a software or hardware problem.

Before I had master code on master device which gave me only sided grounded output.
Now, I did the vice versa and still got the same output which is only one sided grounded.

I changed the hardware wiring only yet but not the software.