Menu

Get directory listing

Majenko Technologies

List a the root directory of the SD card to the serial console.

:::C++
// The WavePro uses SPI, so you need to include the
// SPI library first.
#include <SPI.h>
#include <WavePro.h>

void setup()
{
    char filename[15];
    // Start up and configure the board
    WavePro.begin();

    Serial.begin(9600);

    // When getting the first directory you specify a wildcard
    // match - in this case *.* is everything.
    if(FindFirst("*.*",filename))
    {
        // Display the found filename.
        Serial.println(filename);

        // And get all the rest of the matches.
        while(FindNext(filenam))
        {
            Serial.println(filename);
        }
    } else {
        // We didn't get a first entry - something went wrong.
        Serial.println("Error getting directory list");
    }
}

void loop()
{
}

Part of: [Examples]


Related

Wiki: Examples

MongoDB Logo MongoDB