123456789101112131415161718192021222324252627282930313233343536 |
- #include <SPI.h>
- #include <SD.h>
- #define CS_PIN 5
- void setup() {
- Serial.begin(115200);
-
-
- if (!SD.begin(CS_PIN)) {
- Serial.println("Card Mount Failed");
- return;
- }
- Serial.println("Card Initialized");
-
- File file = SD.open("/HelloWorld.txt", FILE_WRITE);
-
-
- if (!file) {
- Serial.println("Failed to open file for writing");
- return;
- }
-
-
- file.println("Hello World!");
-
-
- file.close();
-
- Serial.println("File written successfully");
- }
- void loop() {
-
- }
|