Combining Two codes into one (Micro SD shield and Gas sensor)

Hi,
I am trying to combine two codes below to record data values for CO2 onto SD card.The first code reads the Co2 value, and prints it onto serial monitor. And, the second code is for Micro SD shield which record data for analog pin 0, 1, and 2. So if anyone can help me out with combining these two codes into one code which can record CO2 values onto SD card.

Any help would be great!!
Thanks in advance.

First code : BasicReading
Second code : SD_logger

BasicReadings.ino (2.33 KB)

sd_logger (1).ino (4.68 KB)

Hey,
programming is doing... so try it yourself and if you hit a (specific) problem, ask it on the forum.
If you give more information about the hardware you are using, I can help you get started!

Writing to a file is just like writing to Serial. Replace "Serial.print(value);" with "file.print(value)". You only then need to open a file on the SD card.

You only then need to open a file on the SD card.

Better plan to close it, too.