I recently purchased the MicroPython ESP32 ebook.
On one of the Random Nerd websites (DS18B20) an example is given using MicroPython to create a webserver for the temperature display.
I would like to assign a fixed (static) IP address to the code. The current code gets the IP address from the DHCP server, and time and again the address changed.
I have tried to add the following line just after the line
BUT, no matter in what format I enter the station.ifconfig….. information, the moment I add that line, the compiler fails with errors.
I am using Thonny, as uPyCraft does not want to connect to the ESP32 unless I do a firmware download each time.
Could you possibly give example code on how to setup a static IP address using micropython for an ESP32?
We don’t have any example about static ip address with MicroPython.
But can you tell me the errors you’re getting?
Note that the ifconfig function should accept a tuple.
So, I think that if you use the following line instead (with double parentheses), it should work:
See in this discussion: https://forum.micropython.org/viewtopic.php?t=2378
Let me know if this solves your issue.
I had the line in both single and double quotes (tuple) but neither of them worked.
This morning I flashed my ESP32 with the latest and greatest available firmware, (esp32-idf3-20191202-v1.11-611-g7f24c2977.bin) and there you go, problem solved.
I hope I can get all my other modifications done before I hit the next obstacle.