Board: Wemos D1 R32
SD module: External SPI MicroSD Card adapter with 16GB Samsung card. Works with Arduino IDE.
Ladies and gentlemen,
My ESP32 board is working fine, blink and DHT22 programs are working correctly using micropython.
I have had the sd card external module working when using the Arduino IDE.
When I try to import the micropython sdcard module, all I get is:
> import sdcard Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: no module named 'sdcard' >>>
I have searched the internet for help to no avail. The course book only mention pyboards with internal sd cards.
Any ideas what I am doing wrong?
Cheers,
Danny
Hi Danny.
The sdcard library is not part of the ESP8266 MicroPython firmware by default.
So, if you want to use that library, you need to upload it to your ESP8266 first.
To do that, follow the next steps:
- Open a new file in upyCraft IDE and copy all the code library: https://github.com/micropython/micropython/blob/master/drivers/sdcard/sdcard.py
- Save the file as sdcard.py
- Upload that file to your board.
- Now, you can import the library in your code and use its functionalities.
If you need more information on how to import a library, you can check page 204 of the MicroPython ebook. It shows how to import the BME280 library, but the steps are the same for any other library.
Let me know if it solves your problem.
Regards,
Sara