softwareSerial Question

Hello all,

I am trying to implement a software serial situation, as my project requires the computer serial interface as well as an arduino - arduino interface as well.

I have been able to follow the tutorial and get the software serial to “echo” the computers serial input, but beyond that I have had difficulties. I need it to form multiple multidigit numbers. Which I have done this way before but just with the computer to Serial communication.

The premise of this basic code, is to take a two digit input (13 of instance) followed by a closer “/” (in a version just using the computer, I am inputting data in a “/” separated manner 10/14/2/ etc)
But this basic testing purposes “13/” is the data I wish to send and do stuff with. Next I will expand it to do two numbers, etc.

So,
can you guys take a look at the following, and perhaps figure out what i’m missing? Their has to be some difference in how the software serial works, that i am not understanding.

This code is on each arduino.

// include the SoftwareSerial library so you can use its functions:
#include <SoftwareSerial.h>

#define rxPin 11
#define txPin 10
#define ledPin 13

// set up a new serial port
SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);
byte pinState = 0;

void setup()  {
  // define pin modes for tx, rx, led pins:
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  // set the data rate for the SoftwareSerial port
  mySerial.begin(4800);
  Serial.begin(9600);
  
  Serial.println("HelloWorld");
}

void loop() {
  
  while(Serial.available()>0){
      byte data = Serial.read();
      delay(10);
      mySerial.write(data);
      Serial.write(data);
  }
  int index = 0;
  while(mySerial.available()>0){
     byte myserialdata=0;
     byte myserialState[1];

     if(index < 1){
     byte inbyte = mySerial.read();
     if (inbyte > 0 && inbyte != '/'){
        myserialdata = myserialdata * 10 + inbyte - '0';
     }
     if (inbyte == '/'){
        myserialState[index] = myserialdata;
        index++; 
        digitalWrite(myserialState[1], HIGH);
        myserialdata = 0;
        mySerial.write(myserialState[1]);
     }
   }
  }
  delay(1000);
}

Thank you for any assistance.
Thank you for your help