as the picture, I'm trying to show qr code. but the "qrcode_initText" receive const char*, so I try put String instead but it's not work what I should do?
thank you
as the picture, I'm trying to show qr code. but the "qrcode_initText" receive const char*, so I try put String instead but it's not work what I should do?
thank you
(deleted)
The image:
The library used is here, and here is the instruction:
int8_t qrcode_initText(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, const char *data) {
return qrcode_initBytes(qrcode, modules, version, ecc, (uint8_t*)data, strlen(data));
}
the function qrcode_initBytes is quite longer.
It requires a char array, although the example uses a String (is it?):
qrcode_initText(&qrcode, qrcodeData, 3, 0, "HELLO WORLD");
It looks like you are creating an array of character pointers where you mean to create an array of characters. Try:
char x[xx.length()];
The "Serial.println(x);" wont do you much good since you are creating an UN-INITIALIZED array of characters.
If you want to pass your String object to a function as a C string, use "xx.c_string()". There is no need for you to create a buffer and copy the contents of your String into it.
xx.c_string() --> xx.c_str()