Skip to content

Commit cd30f14

Browse files
committed
sd.ino
1 parent 81cbbb6 commit cd30f14

File tree

1 file changed

+37
-0
lines changed
  • examples/examples-custom-boards/lyrat-mini/sd

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
// The following should work: but unforunately it does not work for me!
3+
4+
#include <SPI.h>
5+
#include <SD.h>
6+
7+
// These pins are defined in the HAL
8+
#define PIN_SD_CARD_CS 13
9+
#define PIN_SD_CARD_MISO 2
10+
#define PIN_SD_CARD_MOSI 15
11+
#define PIN_SD_CARD_CLK 14
12+
13+
// Arduino Setup
14+
void setup(void) {
15+
Serial.begin(115200);
16+
17+
// setup SPI
18+
SPI.begin(PIN_SD_CARD_CLK, PIN_SD_CARD_MISO, PIN_SD_CARD_MOSI, PIN_SD_CARD_CLK);
19+
20+
// Setup SD and open file
21+
if (!SD.begin(PIN_SD_CARD_CLK, SPI)){
22+
Serial.println("SD.begin failed");
23+
while(true);
24+
}
25+
26+
auto file = SD.open("/audio8000.raw", FILE_READ);
27+
if (!file){
28+
Serial.println("file open failed");
29+
while(true);
30+
}
31+
32+
Serial.println("Success");
33+
}
34+
35+
// Arduino loop - repeated processing
36+
void loop() {
37+
}

0 commit comments

Comments
 (0)