-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#include <SD.h> | ||
uint8_t *loadedModel; | ||
bool x = true; | ||
File myFile; | ||
|
||
void setup() { | ||
Serial.begin(9600); | ||
while (!Serial); | ||
|
||
bool sdBegin = SD.begin(10); | ||
while (!sdBegin) { | ||
Serial.println("Trying to initialize..."); | ||
sdBegin = SD.begin(10); | ||
delay(500); | ||
} | ||
Serial.println("SD Card Initialized."); | ||
|
||
|
||
} | ||
|
||
void loop() { | ||
// put your main code here, to run repeatedly: | ||
// re-open the file for reading: | ||
delay(5000); | ||
if (x){ | ||
myFile = SD.open("head.h"); | ||
if (myFile) { | ||
Serial.println("head.h:"); | ||
size_t modelSize = myFile.size(); | ||
|
||
for (size_t i = 0; i < modelSize; i++) { | ||
Serial.println(myFile.read()); | ||
} | ||
|
||
|
||
// // read from the file until there's nothing else in it: | ||
// while (myFile.available()) { | ||
// Serial.write(myFile.read()); | ||
// } | ||
// close the file: | ||
myFile.close(); | ||
} else { | ||
// if the file didn't open, print an error: | ||
Serial.println("error opening head--ryan.h"); | ||
if (SD.exists("head.h")) Serial.println("head.h exist."); | ||
} | ||
} | ||
x = false; | ||
|
||
|
||
} | ||
|
||
// void loadModel() { | ||
// File file = SD.open("/header--ryan.h", FILE_READ); | ||
// size_t modelSize = file.size(); | ||
|
||
// Serial.print("Found model on filesystem of size "); | ||
// Serial.println(modelSize); | ||
|
||
// // allocate memory | ||
// loadedModel = (uint8_t*) malloc(modelSize); | ||
|
||
// // copy data from file | ||
// for (size_t i = 0; i < modelSize; i++) | ||
// loadedModel[i] = file.read(); | ||
|
||
// file.close(); | ||
// } |