How do I create a temperature data logger?

Hi, I am REALLY new to Arduino-- like the most I've ever accomplished is blinking LED lights. I am working on a science project that requires me to flash high-powered LED's really fast (I used the Sparkfun MOSFET Power Control Kit for this). I managed to get this to work on a Nano, but I needed to switch over to the Uno to add a temperature data logger (I used the directions and materials given by this website: https://diyhacking.com/make-arduino-temperature-data-logger/). Does anyone know how to combine the code and get both the MOSFET and data logger to work? I pasted the code I got to work before below, except now I am using digital pin 4 as the gatePin.

int gatePin = 10;

void setup() { pinMode(gatePin, OUTPUT); }

void loop() { digitalWrite(gatePin,HIGH); delay(10); digitalWrite(gatePin, LOW); delay(90); }

const byte gatePin = 4; 

void setup()
{
  pinMode(gatePin, OUTPUT);
}

void loop()
{
  digitalWrite(gatePin,HIGH);
  delay(10);
  digitalWrite(gatePin, LOW);
  delay(90);
}

Thanks! Do I put the code for the MOSFET and the data logging circuit under the same void setup() and void loop()?

You can only have one setup function and one loop function, so yes. Or you could put code into other functions, but you'd have call those functions from setup and loop.

You can only have one setup function and one loop function, so yes. Or you could put code into other functions, but you'd have call those functions from setup and loop.

I’m really sorry about my cluelessness, but I tried this code:

const byte gatePin = 4; 

#include <SD.h>
#include <SPI.h>
#include <DS3231.h>

File data_file;
DS3231  rtc(SDA, SCL);

const int lm35_pin = A0; 
int temperature;  
int chip_select_pin = 10;

void setup()
{
  pinMode(gatePin, OUTPUT);
  
  rtc.begin();
    rtc.setDOW(MONDAY);     
    rtc.setTime(12, 0, 0);     
    rtc.setDate(1, 1, 2017);
  Serial.begin(9600);
  rtc.begin();  
  pinMode(lm35_pin, INPUT);
  pinMode(chip_select_pin, OUTPUT);
  if (SD.begin()){
    Serial.println("Initialization Successful. Ready to use");
  } else{
    Serial.println("Initialization failed. Check your pin connections or change your SD card");
    return;
  }       
}

void loop()
{
  digitalWrite(gatePin,HIGH);
  delay(10);
  digitalWrite(gatePin, LOW);
  delay(90);
  
  temperature = analogRead(lm35_pin);
  temperature = (temperature*500)/1023;
  data_file = SD.open("test.txt", FILE_WRITE);
  if (data_file) {    
    Serial.print(rtc.getTimeStr());
    data_file.print(rtc.getTimeStr());
    Serial.print(",");
    data_file.print(",");    
    Serial.println(temperature);
    data_file.println(temperature);
    data_file.close();
  }
  else {
    Serial.println("error opening your SD card file. Try again");
  }
  delay(3000);
}

and got these error messages:

Arduino: 1.8.5 (Windows 7), Board: "Arduino/Genuino Uno"

WARNING: Category 'Real-time clock' in library DS3231 is not valid. Setting to 'Uncategorized'
sketch_nov02a:8: error: no matching function for call to 'DS3231::DS3231(const uint8_t&, const uint8_t&)'

 DS3231  rtc(SDA, SCL);

                     ^

C:\Users\cnagel\Documents\Arduino\sketch_nov02a\sketch_nov02a.ino:8:21: note: candidates are:

In file included from C:\Users\cnagel\Documents\Arduino\sketch_nov02a\sketch_nov02a.ino:5:0:

C:\Users\cnagel\Documents\Arduino\libraries\DS3231/DS3231.h:64:3: note: DS3231::DS3231()

   DS3231();

   ^

C:\Users\cnagel\Documents\Arduino\libraries\DS3231/DS3231.h:64:3: note:   candidate expects 0 arguments, 2 provided

C:\Users\cnagel\Documents\Arduino\libraries\DS3231/DS3231.h:60:7: note: constexpr DS3231::DS3231(const DS3231&)

 class DS3231 {

       ^

C:\Users\cnagel\Documents\Arduino\libraries\DS3231/DS3231.h:60:7: note:   candidate expects 1 argument, 2 provided

C:\Users\cnagel\Documents\Arduino\libraries\DS3231/DS3231.h:60:7: note: constexpr DS3231::DS3231(DS3231&&)

C:\Users\cnagel\Documents\Arduino\libraries\DS3231/DS3231.h:60:7: note:   candidate expects 1 argument, 2 provided

C:\Users\cnagel\Documents\Arduino\sketch_nov02a\sketch_nov02a.ino: In function 'void setup()':

sketch_nov02a:17: error: 'class DS3231' has no member named 'begin'

   rtc.begin();

       ^

sketch_nov02a:18: error: 'class DS3231' has no member named 'setDOW'

     rtc.setDOW(WEDNESDAY);     

         ^

sketch_nov02a:18: error: 'WEDNESDAY' was not declared in this scope

     rtc.setDOW(WEDNESDAY);     

                ^

sketch_nov02a:19: error: 'class DS3231' has no member named 'setTime'

     rtc.setTime(12, 0, 0);     

         ^

sketch_nov02a:20: error: no matching function for call to 'DS3231::setDate(int, int, int)'

     rtc.setDate(1, 1, 2014);

                           ^

C:\Users\cnagel\Documents\Arduino\sketch_nov02a\sketch_nov02a.ino:20:27: note: candidate is:

In file included from C:\Users\cnagel\Documents\Arduino\sketch_nov02a\sketch_nov02a.ino:5:0:

C:\Users\cnagel\Documents\Arduino\libraries\DS3231/DS3231.h:94:8: note: void DS3231::setDate(byte)

   void setDate(byte Date); 

        ^

C:\Users\cnagel\Documents\Arduino\libraries\DS3231/DS3231.h:94:8: note:   candidate expects 1 argument, 3 provided

sketch_nov02a:22: error: 'class DS3231' has no member named 'begin'

   rtc.begin();  

       ^

C:\Users\cnagel\Documents\Arduino\sketch_nov02a\sketch_nov02a.ino: In function 'void loop()':

sketch_nov02a:43: error: 'class DS3231' has no member named 'getTimeStr'

     Serial.print(rtc.getTimeStr());

                      ^

sketch_nov02a:44: error: 'class DS3231' has no member named 'getTimeStr'

     data_file.print(rtc.getTimeStr());

                         ^

exit status 1
no matching function for call to 'DS3231::DS3231(const uint8_t&, const uint8_t&)'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

They all seem to stem from a problem importing the DS3231 library. I followed the directions on the Arduino website for importing libraries, but it’s still giving me error messages. Any ideas?