File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
examples/examples-custom-boards/lyrat-mini Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -27,24 +27,27 @@ void setup(void) {
27
27
// setup SPI
28
28
SPI.begin (PIN_SD_CARD_CLK, PIN_SD_CARD_MISO, PIN_SD_CARD_MOSI, PIN_SD_CARD_CS);
29
29
30
- // Determin if there is an SD card
30
+ // Optionally determine if there is an SD card
31
31
pinMode (PIN_SD_CARD_DET, INPUT);
32
32
if (digitalRead (PIN_SD_CARD_DET)!=0 ){
33
33
Serial.println (" No SD Card detected" );
34
34
}
35
35
36
- // Setup SD and open file
36
+ // Open SD library
37
37
if (!SD.begin (PIN_SD_CARD_CS)){
38
38
Serial.println (" SD.begin failed" );
39
39
while (true );
40
40
}
41
41
42
+ // Open an existing file
42
43
auto file = SD.open (" /audio8000.raw" , FILE_READ);
43
44
if (!file){
44
45
Serial.println (" file open failed" );
45
46
while (true );
46
47
}
47
48
49
+ file.close ();
50
+
48
51
Serial.println (" Success" );
49
52
}
50
53
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ void setup(void) {
24
24
pinMode (PIN_SD_CARD_POWER, OUTPUT);
25
25
digitalWrite (PIN_SD_CARD_POWER, LOW);
26
26
27
- // Optionally: Determin if there is an SD card
27
+ // Optionally: Determine if there is an SD card
28
28
pinMode (PIN_SD_CARD_DET, INPUT);
29
29
if (digitalRead (PIN_SD_CARD_DET)!=0 ){
30
30
Serial.println (" No SD Card detected" );
@@ -36,12 +36,15 @@ void setup(void) {
36
36
while (true );
37
37
}
38
38
39
+ // open an existing file
39
40
auto file = SD_MMC.open (" /test.mp3" , FILE_READ);
40
41
if (!file){
41
42
Serial.println (" file open failed" );
42
43
while (true );
43
44
}
44
45
46
+ file.close ();
47
+
45
48
Serial.println (" Success" );
46
49
}
47
50
You can’t perform that action at this time.
0 commit comments