Problem with code for datalogger BMP183 and Adafruit SD Micro Breakoutboard

I have been having problems with making a program that consistently runs . I am beginner to arduino. Here is the following code: ANY ADICE OR HELP IS MUCH APPRECIATED :slight_smile:

include<SPI.h> //Load SPI Library
#include <Adafruit_BMP183.h>
#include <Adafruit_Sensor.h>

#define BMP183_CLK 9
#define BMP183_SDO 8 // AKA MISO
#define BMP183_SDI 7 // AKA MOSI
#define BMP183_CS 6

Adafruit_BMP183 bmp = Adafruit_BMP183(BMP183_CLK, BMP183_SDO, BMP183_SDI, BMP183_CS);

int chipSelect = 10; //chipSelect pin for the SD card Reader
File mySensorData; //Data object you will write your sesnor data to

void setup(){
bmp.begin();
pinMode(10, OUTPUT); //Must declare 10 an output and reserve it
SD.begin(10); //Initialize the SD card reader
}

void loop() {

mySensorData = SD.open(“TrialA500.txt”, FILE_WRITE);
float seaLevelPressure = SENSORS_PRESSURE_SEALEVELHPA; // should be ~1000

delay(100); //Pause between readings.

mySensorData.println(bmp.getAltitude(seaLevelPressure)); //write pressure and end the line (println)
mySensorData.close(); //close the file
}

Here"s some more info: I am not getting any data output and no file is appearing on the SD Card. However, I tested the BMP183 seperately and it produced correct values. I then tested the SD seperately, also working(But on specfic programs, ones found on adafruit site). Whats also puzzeling is that the program had worked before(Same wiring and everything).

Is that really your complete code? You seem to be using an SD library, yet there is no #include directive for SD.h.

It's possible that #include directive is in Adafruit_BMP183.h or Adafruit_Sensor.h but I took a look at the libraries that I guessed you're using for these files and I don't see it. Of course I had to guess about this because you didn't bother to provide instructions for where I could get the libraries you're actually using.