Missing Error Message

hi guys, I have an error in this code. I want to send the hex bytes and receive the same bit long data serially...kindly help me

void setup() {
// Turn the Serial Protocol ON
Serial.begin(9600);
}

void loop()
{
byte message[] = {0xA5, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x0d };

Serial.write(message, sizeof(message));

if (Serial.available()) {

byte byteRead[] = Serial.read();

}
}

See the Serial Input Basics thread and don't hijack this one.

Hi guys, I have an issue with this code. I want to send some hex value serially and expecting to receive the
same kind of data serially but I receive some garbage values on the serial monitor. I also select the same baud rate. Any help will be appreciable. Thanks,

const byte numChars = 88;
char receivedChars[numChars]; // an array to store the received data

boolean newData = false;

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

void loop()
{
uint8_t message[] = {0xA5, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x0d };

Serial.write(message, sizeof(message));

recvWithEndMarker();
showNewData();
}

void recvWithEndMarker() {
static byte ndx = 0;
char endMarker = '\n';
char rc;

while (Serial.available() > 0 && newData == false)
{
rc = Serial.read();

if (rc != endMarker) {
receivedChars[ndx] = rc;
ndx++;
if (ndx >= numChars) {
ndx = numChars - 1;
}
}
else {
receivedChars[ndx] = '\0'; // terminate the string
ndx = 0;
newData = true;
}
}
}

void showNewData() {
if (newData == true) {
Serial.print("data ");
Serial.println(receivedChars);
newData = false;
}
}

(deleted)

spycatcher2k:
+1 for hijack

Also, I'm not a guy!!!! >:(

You look like Bat'man'. :wink:

(deleted)

spycatcher2k:
That's not actually a picture of me! :slight_smile:

Maybe the inner you.

(deleted)

@alikhan968, stop hijacking. Threads split.

@alikhan968, please do cross-post. Threads merged.

@alikhan968, please use code tags.