         char error[] = "clock error" ;
         Serial.println(error);
         for(;;);
+    }
+
+    // initialize SD card
+    pinMode(SS, OUTPUT);
+        if (!SD.begin(chipSelect)) {
+        Serial.println("Card failed, or not present");
+        // don't do anything more:
+        while (1) ;
+    }
+
+    dataFile = SD.open("yuktix.dat", FILE_WRITE);
+    if (! dataFile) {
+        Serial.println("error opening yuktix.dat");
+        // Wait forever since we cant write data
+        while (1) ;
     }
 
     Alarm.timerRepeat(10, log_data);

#include <dht11.h>


#define DHT11_PIN 3 

dht11 DHT11;


void setup() {

    }

    buffer[16] = '\0' ;
    // @debug
    Serial.println(buffer);
    // write to SD card
    dataFile.println(buffer);
    dataFile.flush();
    
}

// param n is to ensure n*10 ms delay
