This is arduino mkr 1010 wifi... It does NOT have EEPROM
I have a python gui that takes user input for network id and password. If it connects, it then saves them to flashmemory so the arduino can auto connect with this id and pass without plugging into a computer and entering it every time. The problem is, what if the user changes the password or network id. I know I can reupload the sketch and start the process again but that is only valid for a developer with the arduino IDE. Is there a way to do this without uploading a sketch? The only solution I can think of is whenever the python GUI is run, it automatically reloads the sketch making the user reset the id and pass but if the python GUI is not run, it does NOT reload the sketch, and thus, the network id and pass are used to connect. Is there another easier way? I can post code if requested but it is kind of lengthy for both arduino and python.
EEPROM. Not sure if the MKR has real EEPROM or if it needs to be simulated. Do a serach for the keywords MKR1010 and eeprom.
Please read the very first line in my original post
Apologies. So do the search.
First hit with Google might be useful: Without EEPROM on MKR 1010 WiFi, how do we save run time parameters? - MKRWIFI1010 - Arduino Forum
You aboviously did not read my post. I am using flashstorage to save variables. That is not the issue. Please find a different forum to post in.
Maybe a small external EEPROM would work for you. There's even at least one library available to run it.
This is a good suggestion but is there any other options? This would involve recoding a lot of stuff and also rewiring some circuits. It sounds like I either do this or get a different microcontroller. I think the latter will save me some time and hassle. Thoughts?
Were you not able to find a flash based EEPROM emulation library? It wasn't clear... or.. is there some reason you have it but it isn't working for you? Those certainly don't erase the sketch.
I am using a flashmemory library and it does write to the flash memory successfully and it stays there after unplugging and plugging back in. My issue is that the only way to reset flash card memory is to upload a sketch so what if someone changes the wifi id or password? They would have to upload the sketch from scratch and reinsert the new info into the flash memory once again. I was wondering if there was another way and there was a good suggestion above about an external EEPROM.
If it fails to connect to wifi could you start it as an AP that could be connected to from a PC/Tablet/phone and put a web page up to enable reset of the SSID & password?
Someone would still need to use another device to connect to it (the AP wifi could have predefined ssid and password of its own).
I originally thought to do something similar to this but ran into the issue I am currently having. Imagine this scenerio of code below...
#include <WiFiNINA.h>
char ssid[] = "yourNetwork"; // your network SSID (name)
char pass[] = "yourPassword"; // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0; // your network key Index number (needed only for WEP)
int led = LED_BUILTIN;
int status = WL_IDLE_STATUS;
WiFiServer server(80);
The ssid and password are hardcoded into the arduino code. The next step I had to do was allow someone to enter these into a GUI. I did this but every time I plugged back in, they did not save. So the next step was to figure out how to permanently save their id and pass. I acheived this with flashmemory saving. All of this works!! but, what if they change the id or password? I would need to clear the flash memory and allow them to reenter a user id and password. The latter is easy but resetting the flashmemory I cannot figure out.
So... with your example, hosting an AP to reenter user id and pass, I still have the same problem as before. How do I reset the flashmemory to permanently resave the credentials? The only way I know of is to reload the script into arduino and start over.
How can hosting an AP achieve anything different from what I have tried? This was a good suggestion I just don't know if it can help me yet.
If when the Arduino cannot connect with Wifi (lets assume because the SSID or PWD has changed) then it could instead try changing to AP mode. Not sure hwo the user would know, but perhaps you could light an LED or something.
Once in AP mode the user could connec to the AP using a predefined SSID and PWD, and assuming DHCP is used issue a ip address to the new client. Using a predefined ip address the user could connec to a small webserver on the Arduino which could issue a page giving the option to change the SSID & PWD used or to quit etc. If the user gives a new SSID & PWD these could be save to flash overwriting the existing ones.
There are plenty of examples of the simple web servers that can serve simple web pages and take values back how much memory they take I am not clear on. Wrting to the flash memory may not be simple - I freely admit I have never tried.
If you were using an external EEPROM the same approach could be used.