1

I get values in serial read using the following code,

int32_t bytesSent = 0;

if (mySerial.available()) {
    bytesSent = mySerial.read();
}

Output:

Serial.write(bytesSent); gives -1199/1211 value.

I need to split this value into two values. That should separate using "/" point.

Value 1 - -1199 Value 2 - 1211

The following code is used for char type values separate when numberArray3[20] = "-1199/1211"

    char numberArray3[20];

   int len = strlen(numberArray3);
   int pos = strcspn(numberArray3,"/");

   char First[20];
   char Second[20];
   
   strncpy(Second, numberArray3+pos+1, len);
   strncpy(First, numberArray3, pos);
   Serial.println(First);
   Serial.println(Second);
0

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.