A tutorial for successfully using the SD Card Reader in any of the expansion modules.



  • Forgive me, but I have literally been searching for hours. I have a need to create a small datalogger and I was following the examples at https://docs.pycom.io/firmwareapi/pycom/machine/sd/. The SINGLE example does not seem to work. the f.readall() method completely fails with an "AttributeError: 'TextIOWrapper' opbject as not attribute 'readall'

    from machine import SD
    import os
    
    sd = SD()
    os.mount(sd, '/sd')
    
    # check the content
    os.listdir('/sd')
    
    # try some standard file operations
    f = open('/sd/test.txt', 'w')
    f.write('Testing SD card write operations')
    f.close()
    f = open('/sd/test.txt', 'r')
    f.readall()
    f.close()
    

    I have literally wasted an entire day working on this. Can someone point me to a comprehensive documentation of the SD card API and its usage? There is no reason for simple things to be this hard. We have come from Particle.io in search of a better product and I am finding the documentation to be a hopeless morass of blind alleys.

    Thanks in advance!


Log in to reply
 

Pycom on Twitter