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.
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
The error must be because I copied from PDF. I re-copied it from github and and it now works without issue. Thank you 🙂