Skip to content

Commit

Permalink
Update main.ino
Browse files Browse the repository at this point in the history
  • Loading branch information
CBVRT2008 committed Apr 18, 2023
1 parent 235d92b commit 6032cd8
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions main/main.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,18 @@ void SDSchrijf(String string, String fileNaam){
file.close();
}

String SDLees(String fileNaam){
File file;
bool SDLees(String fileNaam){
File file = SD.open(fileNaam);
String inhoud = "";
char letter = '978020137962';
file = SD.open(fileNaam);
char letter = 'a';
bool found;

while (file.available()) {
Serial.println("ver");
char a = file.read();
boolean found = file.find(letter);
if (found) {
inhoud = "Gevonden!";
Serial.println("gevonden");
}
if (not found) {
inhoud = "Niet gevonden!";
Serial.println("niet gevonden");
}
//inhoud = inhoud + "x" + file.read();
//inhoud = inhoud + file.read(); //https://cplusplus.com/reference/cstdlib/itoa/
//Serial.print(file.readString());
//strncat(inhoud, file.read(), 2);
found = file.find(letter);
}
file.close();
return inhoud;
return found;
}

//----------------------------------------
Expand All @@ -56,12 +44,20 @@ void setup() {
goto Retry;
}

SDSchrijf("string", "a.txt");
//SDSchrijf("string", "a.txt");

Serial.println("Barcode naar file geprint");
//---------------------------------------

Serial.println(SDLees("a.txt"));
bool gevonden = SDLees("a.txt");

if (gevonden) {
Serial.println("C'est ici");
}
if (not gevonden) {
Serial.println("Ce n'est pas ici!");
}

}

void loop() {
Expand Down

0 comments on commit 6032cd8

Please sign in to comment.