I've tried all the supposed solutions for the exact error, pasted into google, that I could find on every forum including this one and no matter the alleged solution I will either get the error about unsigned int to char*, the error below, or invalid pointers.

Why is this platform so completely unfriendly in data type conversion? It's almost as if the creator/s never wanted any data types to be able convert.

Here's my code that is apparently useless:

  char* DeviceName = "Device-" +  ESP.getChipId();

Error: invalid conversion from 'const char*' to 'char*' [-fpermissive] char* DeviceName = "Device-" + ESP.getChipId();

Then I tried to use the pointers, but I have no idea what I'm doing and I keep getting invalid pointer errors, and/or invalid conversion errors.

  • Hint: Try using sprintf(). cplusplus.com/reference/cstdio/sprintf Commented Nov 26, 2018 at 1:51
  • char buffer [50]; char DeviceName = sprintf(buffer, "Device-%d", ESP.getChipId()); wifiManager.autoConnect(DeviceName); Commented Nov 26, 2018 at 2:04
  • error: invalid conversion from 'char' to 'const char*' [-fpermissive] wifiManager.autoConnect(DeviceName); Commented Nov 26, 2018 at 2:04

1 Answer 1


You can use the c function sprintf(, , ...) The char array has to be big enough to hold your text plus a null to terminate the string.

#include <Arduino.h>

void setup() {
  char out[20];
  sprintf(out, "Device-%08X",ESP.getChipId()); // %08X\n formats the hex and pads with 0s.


void loop() {}


  • Thank you! I tried this and it does output a numeric ID, but I wanted the string ID. ESP8266 Chip ID = 005D4D9D <- this should be the ID... Device-6114717 <- not the numeric conversion here Commented Nov 26, 2018 at 2:12
  • you are welcome - helpful user changed the format string to output 8 hex digits instead since that is what you seem to be looking for.
    – SEngstrom
    Commented Nov 26, 2018 at 2:25
  • Learning is good. To eliminate extra characters you can also use sprintf(out, "Device-%X",ESP.getChipId()); Commented Nov 26, 2018 at 2:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.