Hi,
And thanks for the reply, much appreciated.
The link to the pyboard wifi skin is here
https://www.tinyosshop.com/wifi-skin-fo ... er_name=py
This page also has some test code and library. Code seems to work in that i can connect the local wifi network with it. Thats all i have successfully done so far.
The ftplib i am using is here
https://github.com/SpotlightKid/micropy ... /ftplib.py
My code and the associated error is below:
Code: Select all
from pyb import Pin
from ftplib import FTP
import pywifi
print('Hardware reset for TONYLABS PyWifi')
print('=============================================')
rst = Pin('X12', Pin.OUT)
rst.low()
pyb.delay(20)
rst.high()
pyb.delay(500)
esp = pywifi.ESP8266(1, 115200)
print('Testing generic methods')
print('=======================')
print('AT startup...')
if esp.test():
print('Success!')
pyb.LED(1).on() #GREEN LED ON
else:
print('Failed!')
'''
print('Soft-Reset...')
if esp.reset():
print('Success!')
else:
print('Failed!')
'''
print('Another AT startup...')
if esp.test():
print('Success!')
else:
print('Failed!')
print('Check ESP8266 firmware version')
print('==============================')
esp.version()
print('Testing WIFI methods')
print('====================')
'''
1: station mode
2: accesspoint mode
3: accesspoint and station mode
'''
wifi_mode = 1
print("Testing get_mode/set_mode of value '%s'(%i)..." % (pywifi.WIFI_MODES[wifi_mode], wifi_mode))
esp.set_mode(wifi_mode)
if esp.get_mode() == wifi_mode:
print('Success!')
else:
print('Failed!')
pyb.delay(100)
print('Connecting to network')
print('==============================')
esp.connect(ssid='Taihoro', psk='Innxxxxxxx')
pyb.delay(20)
print(esp.get_station_ip())
pyb.LED(1).off() #GREEN LED ON
pyb.LED(4).on() #BLUE LED ON
print('Connecting to an FTP network')
print('==============================')
ftp = FTP('ftp.python.org') # connect to host, default port
ftp.login() # default, i.e.: user anonymous, passwd anonymous@
ftp.retrlines('LIST') # list directory contents
ftp.quit()
Code: Select all
Traceback (most recent call last):
File "main.py", line 100, in <module>
File "ftplib.py", line 206, in __init__
File "ftplib.py", line 264, in connect
File "ftplib.py", line 226, in _create_connection
File "ftplib.py", line 107, in _resolve_addr
TypeError: function takes 2 positional arguments but 3 were given
MicroPython v1.9.2 on 2017-08-23; PYBv1.1 with STM32F405RG
Type "help()" for more information.
Any help is much appreciated.
Cheers.