Thank you for letting me know but I don't quite understand . Will putting it in loop make it automatically be seen on the OLED ? sorry
So I think I did it I
#include "Arduino_SensorKit.h"
#include <SPI.h>
#include <Wire.h>
#include <SD.h>
String text;
const int chipSelect = 10;
File myFile;
void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Initializing SD card...");
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
return;
}
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
myFile = SD.open("BPM.txt", FILE_WRITE);
// if the file opened okay, write to it:
if (myFile) {
Serial.print("Writing to test.txt...");
Serial.print("testing 1, 2, 3.");
// close the file:
myFile.close();
Serial.println("done.");
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
// re-open the file for reading:
myFile = SD.open("BPM.txt", FILE_READ);
if (myFile) {
Serial.println("BPM.txt:");
// read from the file until there's nothing else in it:
while (myFile.available()) {
text = myFile.readString();
delay(100);
//Serial.println(text);
}
// close the file:
myFile.close();
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
Serial.println(text);
// Oled.setFont(u8x8_font_chroma48medium8_r);
//Oled.setCursor(0, 3);
Oled.begin();
Oled.setFlipMode(true);
}
void loop(){
// re-open the file for reading:
myFile = SD.open("BPM.txt", FILE_READ);
if (myFile) {
Oled.println("BPM.txt:");
// read from the file until there's nothing else in it:
while (myFile.available()) {
text = myFile.readString();
delay(1000);
Oled.println(text);
}
// close the file:
myFile.close();
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
Oled.setFont(u8x8_font_chroma48medium8_r);
Oled.setCursor(0, 3);
Oled.refreshDisplay();
delay(1000);
}
but I am seeing this
