Issue with conversion from 'const char*' to 'char*'

Hello all!

Im testing Arduino IoT cloud with Portenta H7 with a couple of sensors, but when i try to validate the code, i have this error message (al error messages attached below):

libraries\Arduino_ConnectionHandler\src\Arduino_WiFiConnectionHandler.cpp:93:16: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]

     WiFi.begin(_ssid, _pass);

i try to change the way the sketch comunicates the pass & SSID to libraries:

1st way - it is the same as all the examples

const char SSID[] = SECRET_SSID;    // Network SSID (name)
const char PASS[] = SECRET_PASS;    // Network password (use for WPA, or use as key for WEP)

2nd - i made this change because i see at the destiny function SSID and pass was declared by this way:

char SSID[] = SECRET_SSID;    // Network SSID (name)
const char PASS[] = SECRET_PASS;    // Network password (use for WPA, or use as key for WEP)

3rd way - IdahoWalker's clue

char SSID[] = SECRET_SSID;    // Network SSID (name)
const char* PASS = SECRET_PASS;    // Network password (use for WPA, or use as key for WEP)

4th - Same but changing the SSID to pointer.

char* SSID = SECRET_SSID;    // Network SSID (name)
const char* PASS = SECRET_PASS;    // Network password (use for WPA, or use as key for WEP)

5th

const char* SSID = SECRET_SSID;    // Network SSID (name)
const char* PASS = SECRET_PASS;    // Network password (use for WPA, or use as key for WEP)

6th EDIT: CORRECT ONE -> i recommend you find the library which is envolved or called (WiFi.h, at this case, to init the WiFi connection) and find the function (begin, at this case). Here, the function is declared:

int arduino::WiFiClass::begin(const char* ssid, const char *passphrase)

So i introduce the code the same:

const char* SSID = SECRET_SSID;    // Network SSID (name)
const char *PASS = SECRET_PASS;    // Network password (use for WPA, or use as key for WEP)

Here is the code: GitHub - amoya04/Portenta-H7-Arduino-IoT-Cloud: This project is in progress, its pending to made changes because it doesnt compiles..

Could someone help me please?

errorcode_AIoT.txt (11.1 KB)

clue: const char* mqtt_topic = "Home/#";

I know the feeling, strings chars String, all that can drive one batty.

Hello IdahoWalker! Thanks for your help, but it still doesnt work, its very strange... I update the main message, following your clue.

Regards!!

WARNING: library ArduinoIoTCloud claims to run on samd, esp8266 architecture(s) and may be incompatible with your current board which runs on mbed architecture(s).

WARNING: library Arduino_ConnectionHandler claims to run on samd, esp32, esp8266 architecture(s) and may be incompatible with your current board which runs on mbed architecture(s).

WARNING: library ArduinoECCX08 claims to run on samd, megaavr architecture(s) and may be incompatible with your current board which runs on mbed architecture(s).

exit status 1

Error compiling for board Arduino Portenta H7 (M7 core).

is your error. First see if it will compile with the blink program. if not try with a different board if you have one. or play around with the board settings. an uno will not work if you are using internet. try a cheap esp8266 nodemcu or something. or in boards manager find a proper board for the compiler to use. good luck

Hello!!

This libraries are compatibles with Portenta H7, but this message are not updated because Portenta are available at Arduino IoT cloud...

@Quijano__

I wonder if you are not entering the SSID etc. in the SECRETS tab
You are using the ONLINE IDE yes ?
In which case there is a seperate tab for those credentials and they must be entered in there.

EDIT

Please do not post pics of that tab with your credentials in them !
Revert you sketch to its ORIGINAL FORM and then put your creds in the secret tab and try to compile.
Lets go from that point.

Hello ballscrewbob! thanks for your answer.

I introduce my credentials using a tab "arduino_secrets". They are declared like:

#define SECRET_SSID "Secret SSID"
#define SECRET_PASS "Ultra Secret Pass"

Im using the dekstop ide, because the online ide only allows one upload to the device. But this sketch is based on the sketch created with Arduino IoT cloud, which include the libraries and tab for arduino secrets declared as i show.

Regards

@@Quijano__

You may also post the SHARE link for the sketch in here as it will omit your credentials but still allow others to test it directly online using thier own credentials.

SECRETS function was made to do just that and keep your secret information "secret" from others.

Using the desktop IDE has on occasion balked at the secrets function so you are better off using the online IDE for those aspects.

IIRC there is a set process in place for the online work and you may have stepped out of it by using the desktop.

if that is the problem just code the secrets in you .ino and see if anything changes. I never bother with the "secrets" file.

@sevenoutpinball

Wild guesses are not a viable option.

EDIT and in answer to your Q in your tag KARMA cannot be swapped for anything.
It is a meaningless number but some people found your answers useful so gave you one based on that.
Very few give KARMA in the larger scheme of things even if your answer was ON POINT.

At best it is a quite basic measure of the persons skill set in the forum.

sevenoutpinball: "if that is the problem just code the secrets in you .ino and see if anything changes. I never bother with the "secrets" file."

I try this too, but the IDE reports the same error.

Then you need to go back to the beginning and follow the process through the CREATE EDITOR.

Hello all.

Now i think i solved the issue, introducing the data like this:

const char* SSID = SECRET_SSID;    // Network SSID (name)
const char *PASS = SECRET_PASS;    // Network password (use for WPA, or use as key for WEP)

It is the same way it was introduced at the function begin at wifi.cpp.

But i dont understand why dont make the conversion auto, because in all the sketches i saw, the credentials are introduced like the 1st iteraction (as an array).

Best regards and thanks for all

SECRET has a unique way of being handled to actually make it work.
It was designed specifically for the online editor.

That it can mostly work in the desktop is I suspect more of a compatibility release than pure design.

Having been involved in some of the CREATE EDITOR testing that was a feature that took me a couple of attempts to get my head around.

I tried deleting my karma question and the system here is broken, it won't let me.

I did it for you. You can however change it yourself in your profile settings.