Reputation:
when I try to control my esp32 microcontorller with micropython I get the following error:
File "c:/Users/supre/Documents/Python Programme/micropython/blinktest.py", line 1, in <module>
from machine import Pin
ModuleNotFoundError: No module named 'machine'
I try to test the basic blinktest code:
from machine import Pin
import time
led = Pin(12, Pin.OUT)
for n in range(1,30):
led.value(0) #on
sleep(1)
led.value(1) #off
sleep(1)
I can't install this module via pip or anaconda (when I try to install the module via pip the build fails)
Is this error maybe caused because I have installed micropython the wrong way?
So it would be very nice if someone could help me out with this problem.
Upvotes: 5
Views: 32735
Reputation: 1697
It appears you are attempting to run the blinktest.py
on your PC , rather than on your ESP32 microcontroller.
the giveaway is that the machine
module cannot be found which is part of the ESP32 firmware that should be installed on the ESP32.
you would need to :
blinktest.py
to your ESp32blinktest.py
by executing import blinktest
for a detailed step by step for the ESP32: http://docs.micropython.org/en/latest/esp32/tutorial/intro.html#esp32-intro
Upvotes: 6