When the SD Card is not plugged in, it gives me that error roughly every second. when it is, it gives it to me alround 50 times per second. i am deducing from that that i wired everything correctly, since i get different results when the card is plugged in / not plugged in.
Edit: Or if you want to use D4 for some reason, you still have to have D10 configured as an output. SdFat probably does this for you, but SD.h probably does not. Google's AI provides this wisdom, which may evey be right for once:
Even if not using D10 as the Chip Select (CS) pin for your SD card, D10 still needs to be configured as an output when using the Arduino SD library.
"This is because D10 (the SS pin on many Arduino boards) is part of the SPI (Serial Peripheral Interface) communication protocol that the SD library utilizes. The SPI communication relies on the SS pin being in an output mode to function correctly, even if it's not actively being used to select a specific device. The SD library often implicitly expects this configuration for proper operation of the underlying SPI hardware.
Therefore, including pinMode(10, OUTPUT); in your setup() function is a recommended practice when working with the SD library, regardless of which pin you designate as your SD card's CS pin in SD.begin()."
But if you use D10 as the CS, it's automatically set as an output.