ESP 32-Using SDcard and Datalogging

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
Gabriel.Reis
Posts: 1
Joined: Thu Jan 16, 2020 5:21 pm

ESP 32-Using SDcard and Datalogging

Post by Gabriel.Reis » Thu Jan 16, 2020 5:38 pm

Hello, i am starting in ESP 32 with micropython, and one of the parts of my projects is use a SD Card Reader for save some variables (like temperature and weight), but i am having some problems to put the SD Card Reader to work.

the first problem is this message : "AttributeError: 'module' object has no attribute 'SDCard'", i am using the sdcard.py from https://github.com/micropython/micropyt ... /sdcard.py, but i don't know how to solve this problem. And the second one is how can i put the SD card to save the variables that i said before?

The code i am using for test the SD card

Code: Select all

import machine, sdcard, os
from machine import Pin, SPI
spisd = SPI(-1, sck=Pin(14), mosi=Pin(15), miso=Pin(2))
sd = sdcard.SDCard(spisd, machine.Pin(13))
os.mount(sd, '/sd')
os.listdir('/sd')
os.umount('/sd')

shaoziyang
Posts: 294
Joined: Sun Apr 17, 2016 1:55 pm

Re: ESP 32-Using SDcard and Datalogging

Post by shaoziyang » Fri Jan 17, 2020 1:57 am

Please refer to the following instructions:

http://docs.micropython.org/en/latest/l ... DCard.html

Post Reply