Tuple as parameter for ifconfig / tuple parameters as variables

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
BigMan
Posts: 22
Joined: Sat Oct 29, 2016 2:29 pm

Tuple as parameter for ifconfig / tuple parameters as variables

Post by BigMan » Sat Jun 22, 2019 7:20 pm

Hi,
when I do this:

Code: Select all

self.sta_wlan.ifconfig(('10.0.0.34', '255.255.0.0', '10.0.0.10', '10.0.0.10'))
my ESP8266 connects to my network with a fixed IP - as desired.

But why is the following not working (I assume I am doing something wrong with the tuple):

Code: Select all

ip = '10.0.0.34'
netzmaske = '255.255.0.0'
gateway = '10.0.0.10'
dns = '10.0.0.10'
self.sta_wlan.ifconfig((ip, netzmaske, gateway, dns))

User avatar
Roberthh
Posts: 1828
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Tuple as parameter for ifconfig / tuple parameters as variables

Post by Roberthh » Sat Jun 22, 2019 8:06 pm

generally it should work. Since this ifconfig seems to be in a class, visibility of ip, netzmakse, ... may be an issue. Try to use self.ip, self.netzmaske, ...

Post Reply