• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Even simple code fails – MicroPython access point – ESP32/8266

Q&A Forum › Category: ESP8266 › Even simple code fails – MicroPython access point – ESP32/8266
0 Vote Up Vote Down
Gary asked 3 years ago

Even this simple code fails:

import network

sta = network.WLAN(network.STA_IF)

sta.active(True)

sta.scan()

sta.connect(‘my ssid’,’my password’)

sta.isconnected()

# I see valid networks here…

sta.ifconfig()

#(‘0.0.0.0’, ‘0.0.0.0’, ‘0.0.0.0’, ‘208.67.222.222’)

 

 

Hi Sara, et all
Yet anther attempt to get a WIFI AUTOCONNECT  working ….
https://www.youtube.com/watch?v=gGB8iw7R-rM
He provides source code
I have spent 3 days working on this, so far no success

 

In Thommy the errors I get are:

MicroPython v1.17-12-g26e539a1b on 2021-09-03; ESP module with ESP8266
Type “help()” for more information.
>>> %Run -c $EDITOR_CONTENT
RUN : main.py
Traceback (most recent call last):
File “<stdin>”, line 3, in <module>
File “ConnectWifi.py”, line 13, in connect
NameError: name ‘MicroPython’ isn’t defined
>>>

 

In PyCharmis get:

RUN: boot.py
RUN : main.py
Traceback (most recent call last):
File “main.py”, line 4, in <module>
File “ConnectWifi.py”, line 22, in connect
KeyboardInterrupt:

MicroPython v1.17-12-g26e539a1b on 2021-09-03; ESP module with ESP8266
Type “help()” for more information.
>>>

What am I doing wrong???

Thanks,
Gary

1 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
Can you share a link to all the files you’re trying to upload?
I couldn’t get the code from the youtube video.
To share the code use a link to pastebin, github gist, or other suitable places to share code. Otherwise, the indentation will be messed up.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.