Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7759891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:44:28+00:00 2026-06-01T13:44:28+00:00

Please bear with me, I’m new at C and I’m trying to program an

  • 0

Please bear with me, I’m new at C and I’m trying to program an Arduino. I want to write a program that spits out a data frame of specific length with byte values ranging from 0-255. The minimum code to reproduce the error is in the code block below. When compiling I receive the following error:

sketch_apr09b.cpp: In function ‘char assembleFrame()’:
sketch_apr09b.cpp:9:10: error: invalid conversion from ‘char*’ to ‘char’

Now my impression is that I’m mistreating the ‘return frame’, but I just can’t figure out what’s wrong.

char assembleFrame() {
  char frame[] = { 
    0x61 , 0x62 , 0x63
  };
  return frame;
}

void setup() {
  Serial.begin( 115200 );
};

void loop() {
  char frame = assembleFrame();
  Serial.print( frame );
}

When I run a hexdump on the receiving PC, I want to see:

00000000  61 62 63                                          |abc|
00000003

I’ve found a lot of similar questions, wasn’t able to figure out what I’m doing wrong.

EDIT:
This is what I came up with so far, but receiving wrong data. I think I’m sending the pointer to the actual data with this.

byte *assembleFrame() {
  byte frame[] = { 4 , 'a' , 'b' , 'c' };
  return frame;
}

void setup() {
  Serial.begin( 115200 );
};

void loop() {
  byte *frame = assembleFrame();
  Serial.write( frame , frame[ 0 ] );
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T13:44:29+00:00Added an answer on June 1, 2026 at 1:44 pm

    The char type is used to store a single char (a byte).

    Your function definition char assembleFrame specifies the function will only be returning a single char, so when you try to return a char[] / char * (char array/pointer), it fails.

    Looks like Serial.print() can handle a char *, which will potentially need to be null-terminated (because it asks for no length specifier).

    char *assembleFrame() {
      char frame[] = {
        0x61, 0x62, 0x63, 0x00 // null byte to signify end of string
      };
      return frame;
    }
    
    void setup() {
      Serial.begin( 115200 );
    };
    
    void loop() {
      char *frame = assembleFrame();
      Serial.print( frame );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please bear with me, I'm just learning C++. I'm trying to write my header
I am new to C++ so please bear with me. I am trying to
please bear with my newbie questions.. I was trying to convert PDF to PNG
I am new to bash so please bear with me if this is a
I'm new to Git so please bear with me. I initialized my repository and
I am fairly new to PHP so please bear with me :) What I
I am totally new to Sharepoint (2007) so please bear with me. I would
I am new to iOS development so please bear with me. I have created
I'm new to Java development so please bear with me. Also, I hope I'm
I'm fairly new to the world of Silverlight so please bear with me. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.