Using a knockoff Arduino Nano (pinout seems to be the same), I would like to record data to an external SD card. I have everything hooked up (correctly I think) but I continue to fail to initialize the card using SD.begin()
.
Here's a snippet of code that I'm running to do this:
//Wire and MS5803_I2C libraries for communicating with the pressure sensor.
#include <Wire.h>
#include <SparkFun_MS5803_I2C.h>
// For the SD card reader.
#include <SPI.h>
#include <SD.h>
const int chipSelect = 4;
void setup(void) {
Serial.begin(9600); // Set baud rate.
pinMode(10, OUTPUT); // Set data output pin for the SD card reader.
digitalWrite(10, HIGH);
// see if the card is present and can be initialized:
if (!SD.begin(10)) {
Serial.println("Card failed, or not present");
// don't do anything more:
return;
}
Serial.println("card initialized.");
delay(500); // Wait half a second before continuing.
}
void loop(void) {
Serial.println("Hello Library!");
delay(100000);
}
Here's the Nano pinout:
And a picture of the circuit.