Hello
I am making a project where I am logging data on a SD card using the vma304 datalogger. To test the datalogger I have made this script.
#include <SD.h>
#include <SPI.h>
#include "SdFat.h"
const int CS = 10;
int i = 0;
void setup()
{
Serial.begin(9600);
pinMode(CS, OUTPUT);
if (!SD.begin(CS)) {
Serial.println("No SD Card present");
return;
}
Serial.println("SD Card Ready");
}
void loop() {
File dataFile = SD.open("test.txt", FILE_WRITE);
if (dataFile) {
dataFile.println("Test");
dataFile.close();
}
else {
Serial.println("error opening the file");
}
delay(500);
}
and my connections are:
CS - 10
MOSI - 11
MISO - 12
SCK - 13
My problem is that the program always returns a "No SD card present". I have checked that all the connections are valid, that the libraries are up to date, and bought a new datalogger in case the old one was broken. Does anybody know if there is something wrong with my script or if I am making some kind of other mistake?
Thanks
PS. I am kind of new to arduino so don't judge me too hard for some newbie mistake.