   //read from sensors
   for(unsigned int i=0; i < 6; ++i) sensor_array[i] = analogRead(i);
 
-  print();
+  print_log();
 }


void loop() {

  delay(5000);

  log_file = SD.open("log.csv", FILE_WRITE);

  // update GPS
  while(gps_port.available()) gps.encode(gps_port.read());

#define SD_pin 10

// code!
// #define DEBUG
#ifdef DEBUG
#define print   Serial.print
#define println Serial.println
#else
#define print   log_file.print
#define println log_file.println
#endif

int sensor_array[6];
File log_file;

void print_log() {

  print(gps.location.lat(), 6);
  print(',');
  print(gps.location.lng(), 6);
  print(',');
  print(gps.time.hour());
  print(',');
  print(gps.time.minute());
  print(',');
  print(gps.time.second());
  print(',');
  print(gps.date.day());
  print(',');
  print(gps.date.month());
  print(',');
  print(gps.date.year());
  print(',');
  print(gps.speed.mph());
  print(',');
  print(map(CO,  0, 1023, 20,  2000)); //ppm
  print(',');
  print(map(CO2, 0, 1023,  0, 10000)); //ppm
  print(',');
  print(map(O3,  0, 1023, 10,  2000)); //ppb
  print(',');
  print(map(NO,  0, 1023, 50, 10000)); //ppb
  print(',');
  print(map(TEMP, 0, 1023 , -40, 125)); // celsius
  print(',');
  print(map(WIND, 0, 1023 , -40, 85)); // celsius
  println();
}

void setup() {

  #ifdef DEBUG
  Serial.begin(9600);
  #endif

  gps.begin(GPS_BAUD_RATE); //GPS Setup
  SD.begin(SD_PIN);         //SD card start
