Hex parsing with arduino <SoftwareSerial.h>


I hacked this one

soldered


connect to pc

and coded

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
int mybyte;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
mySerial.begin(2400);

}
void loop() {
// put your main code here, to run repeatedly:
if (mySerial.available() > 0) {
mybyte= mySerial.read();

if(mybyte<0x10)
{
Serial.print(“0”);
}

Serial.print(mybyte, HEX);
//Will print the two nibbles of a byte.
}
}

This is my code.

The result is


The data set always begin with 1’x’(‘x’ is hex type number) and always end with E8.

Please help me.

Does the data set a!ways begin with 1B (esc)?

groundfungus:
Does the data set a!ways begin with 1B (esc)?

The data set always begin with 1'x'('x' is hex type number) and always end with E8.