Hi, im newbie and i am using an ESP8266 nodeMCU board. I am trying to connect to my wifi with the code:
import network
ssid="casa_1001"
password="xxxxxxxxxxx"
network.WLAN(network.AP_IF).active(False)
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
sta_if.connect(ssid, password)
But i am getting the error below
Traceback (most recent call last):
File "/Users/mac/anaconda3/bin/ampy", line 11, in <module>
load_entry_point('adafruit-ampy==1.0.7', 'console_scripts', 'ampy')()
File "/Users/mac/anaconda3/lib/python3.6/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/Users/mac/anaconda3/lib/python3.6/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/Users/mac/anaconda3/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/mac/anaconda3/lib/python3.6/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/mac/anaconda3/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/Users/mac/anaconda3/lib/python3.6/site-packages/adafruit_ampy-1.0.7-py3.6.egg/ampy/cli.py", line 337, in run
output = board_files.run(local_file, not no_output)
File "/Users/mac/anaconda3/lib/python3.6/site-packages/adafruit_ampy-1.0.7-py3.6.egg/ampy/files.py", line 303, in run
out = self._pyboard.execfile(filename)
File "/Users/mac/anaconda3/lib/python3.6/site-packages/adafruit_ampy-1.0.7-py3.6.egg/ampy/pyboard.py", line 275, in execfile
return self.exec_(pyfile)
File "/Users/mac/anaconda3/lib/python3.6/site-packages/adafruit_ampy-1.0.7-py3.6.egg/ampy/pyboard.py", line 269, in exec_
raise PyboardError('exception', ret, ret_err)
ampy.pyboard.PyboardError: ('exception', b'', b'Traceback (most recent call last):\r\n File "<stdin>", line 19, in <module>\r\nTypeError: function takes 2 positional arguments but 3 were given\r\n')
Someone has any idea to help me?
Newbie with WIFI problem
Re: Newbie with WIFI problem
Use this code, add while......jpbrs wrote: ↑Mon Mar 25, 2019 10:17 pmHi, im newbie and i am using an ESP8266 nodeMCU board. I am trying to connect to my wifi with the code:
import network
ssid="casa_1001"
password="xxxxxxxxxxx"
network.WLAN(network.AP_IF).active(False)
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
sta_if.connect(ssid, password)
But i am getting the error below
Traceback (most recent call last):
File "/Users/mac/anaconda3/bin/ampy", line 11, in <module>
load_entry_point('adafruit-ampy==1.0.7', 'console_scripts', 'ampy')()
File "/Users/mac/anaconda3/lib/python3.6/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/Users/mac/anaconda3/lib/python3.6/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/Users/mac/anaconda3/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/mac/anaconda3/lib/python3.6/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/mac/anaconda3/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/Users/mac/anaconda3/lib/python3.6/site-packages/adafruit_ampy-1.0.7-py3.6.egg/ampy/cli.py", line 337, in run
output = board_files.run(local_file, not no_output)
File "/Users/mac/anaconda3/lib/python3.6/site-packages/adafruit_ampy-1.0.7-py3.6.egg/ampy/files.py", line 303, in run
out = self._pyboard.execfile(filename)
File "/Users/mac/anaconda3/lib/python3.6/site-packages/adafruit_ampy-1.0.7-py3.6.egg/ampy/pyboard.py", line 275, in execfile
return self.exec_(pyfile)
File "/Users/mac/anaconda3/lib/python3.6/site-packages/adafruit_ampy-1.0.7-py3.6.egg/ampy/pyboard.py", line 269, in exec_
raise PyboardError('exception', ret, ret_err)
ampy.pyboard.PyboardError: ('exception', b'', b'Traceback (most recent call last):\r\n File "<stdin>", line 19, in <module>\r\nTypeError: function takes 2 positional arguments but 3 were given\r\n')
Someone has any idea to help me?
Code: Select all
import network
ssid="casa_1001"
password="xxxxxxxxxxx"
network.WLAN(network.AP_IF).active(False)
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
sta_if.connect(ssid, password)
while not sta_if.isconnected():
pass
-
- Posts: 969
- Joined: Sat Feb 03, 2018 7:02 pm
Re: Newbie with WIFI problem
I'm not even sure what the exception has to do with your micropython code because the exception occurs on the host system, not the esp8266.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode