Char array convert to uint8_T

I need to input text from the serial monitor in the char array form and pass it a uint8_t. A custom library then sends the uint8_t array to another arduino. The program is not converting the char array to uint8_t as I would expect. can you see any obvious issues.

#include <Manchester.h>
#define TX_PIN 5  //pin where your transmitter is connected
#define LED_PIN 13 //pin for blinking LED

const byte numChars = 32;
uint8_t message[numChars]= {'\0'};
char receivedChars[numChars]; 
boolean newData = false;
uint8_t moo = 1;

void setup() {
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, moo);
  Serial.println("Enter a Message:");
  man.setupTransmit(TX_PIN, MAN_1200);

void loop() {

  static byte ndx = 0;
  char endMarker = '\n';
  char rc;

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

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

  if (newData == true) {
    Serial.print("This just in ... ");
    message[numChars] = receivedChars[numChars];
    man.transmitArray(numChars, message);
    moo = ++moo % 2;
    digitalWrite(LED_PIN, moo);
    newData = false;

The program is not converting the char array to uint8_t as I would expect.

Where in the program did you expect to make that conversion?

Since uint8_t and char are the same size, just lie to the compiler and cast the char array to an array of uint8_t. It will never know the difference. What comes out the other end of the line would be the same either way.

    message[numChars] = receivedChars[numChars];

Were you hoping to copy the entire array with that statement? It doesn't even copy a char that belongs to the string you're interested in.

this isn’t performing what the OP thinks is happening:

message[numChars] = receivedChars[numChars];

that is copying an undefined element out of the range of recievedChars to an undefined element of message.

arrays of size = numChars have a total of numChars elements numbered zero to numChars - 1

take Delta_G’s advice and use a loop to cast/copy the array:

for (int i = 0; i < numChars; i++)
  message[i] = uint8_t(recievedChars[i]);

No loop, just cast the whole thing when you pass it to whatever function is expecting an array of uint8_t.

 someFunctionExpectsByteArray((uint8_t*) someCharArray);


memcpy(message, receivedChars, numChars);