#include "SPI.
h"
#include "DHT.h"
#include "DS3231.h"
#include "SD.h"
// Arduino data logger with SD card and DHT11 humidity and temperature sensor
#define DHTPIN 7 // DHT11 data pin is connected to Arduino pin 4
#define DHTTYPE DHT11 // DHT11 sensor is used
DHT dht(DHTPIN, DHTTYPE); // Initialize DHT library
DS3231 rtc(SDA, SCL);
void setup() {
File dataFile = [Link]("[Link]", FILE_WRITE);
if (dataFile) {
[Link]("Date,Time,Temperature,Humidity"); //Write the first row of
the excel file
[Link]();
}
[Link]();
[Link](FRIDAY); // Set Day-of-Week to SUNDAY
[Link](23, 31, 45); // Set the time to [Link] (24hr format)
[Link](8, 11, 2019); // Set the date to January 1st, 2014 //INITIALIZING
PLX DAQ
[Link]("CLEARDATA"); //clears up any data left from previous projects
[Link]("LABEL,Date,Time,Temperature"); //always write LABEL, to indicate
it as first line
}
void loop() {
delay(500);
float t = [Link]();
[Link]("DATA"); //always write "DATA" to Indicate the following as Data
[Link](","); //Move to next column using a ","
[Link]("DATE"); //Store date on Excel
[Link](","); //Move to next column using a ","
[Link]("TIME"); //Store date on Excel
[Link](","); //Move to next column using a ","
[Link](t); //Store date on Excel
[Link](","); //Move to next column using a ","
[Link](); //End of Row move to next row
File dataFile = [Link]("[Link]", FILE_WRITE);
// if the file opened okay, write to it:
if (dataFile) {
[Link]([Link]()); //Store date on SD card
[Link](","); //Move to next column using a ","
[Link]([Link]()); //Store date on SD card
[Link](","); //Move to next column using a ","
[Link](t); //Store date on SD card
[Link](","); //Move to next column using a ","
[Link](); //End of Row move to next row
[Link](); //Close the file
}
else{
[Link]("OOPS!! SD card writing failed");
}
}