#includeFile myFile; if (SD.begin(4)) { myFile = SD.open("example.txt", FILE_READ); }
#includeIn this example, we again use the `SD.begin()` function to initialize the SD card. We then use `SD.open()` to open the file "example.txt" in write mode, which means we can write data to the file. We do this by using the `myFile.print()` function to add some text to the file. Finally, we use `myFile.close()` to save and close the file. Package/Library: SD library (included with Arduino IDE)File myFile; if (SD.begin(4)) { myFile = SD.open("example.txt", FILE_WRITE); myFile.print("This is some text."); myFile.close(); }