• 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

MicroPython Programming with ESP8266 – PWM – Pulse Width Modulation Issue

Q&A Forum › Category: ESP8266 › MicroPython Programming with ESP8266 – PWM – Pulse Width Modulation Issue
0 Vote Up Vote Down
marbel1337 asked 6 years ago

I’ve made it through all the modules in this guide so far, but am stuck on the PWM – Pulse Width Modulation module. I think the code is caught up for some reason. I’m using the ESP-12E.
First I download and run the code from the example on page 104. The terminal outputs the following:
Ready to download this file,please wait!
..
download ok
os.listdir(‘.’)
Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
NameError: name ‘os’ is not defined
>>>
reflush tree false
 
I then push the “RST” button on the ESP-12E and the terminal outputs the following:
$`
B$`l$`rےo$$`
_task(40100130, 3, 3fff83ec, 4)

Traceback (most recent call last):
File “main.py”, line 7
SyntaxError: invalid syntax
MicroPython v1.9.4-8-ga9a3caad0 on 2018-05-11; ESP module with ESP8266
Type “help()” for more information.
>>>
Any clue what my issue is? I copied the code from page 104 in the course.

Question Tags: ESP12-E, ESP8266, MicroPython
3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 6 years ago

Hi marbel.
I’ve tested the code again on a ESP-12E and it is working just fine.
Please make sure that you have copied the code correctly. You can go here to copy the code: https://raw.githubusercontent.com/RuiSantosdotme/ESP-MicroPython/master/code/GPIOs/PWM/pwm_basic.py
Sometimes copying the code directly from the PDF changes indentation and the code doesn’t work.
Regards,
Sara

0 Vote Up Vote Down
marbel1337 answered 6 years ago

The error must be because I copied from PDF. I re-copied it from github and and it now works without issue. Thank you 🙂

0 Vote Up Vote Down
Sara Santos Staff answered 6 years ago

Great!
I’m glad it is working now! 

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.