From Arduino to an SD-card

Hello everyone!

I am working on a projekt. I am new to arduino and i need a little help with the programming.

I want to receive data from a sensor that is connected to an Arduino. I want to syncronize the data to a local time.

So what i did basically is to take the data from the sensor and send it 4 times by masking the data and then i syncronized the data wih the time in order to get a new epoch time.

I used the following code.

#include <SoftwareSerial.h>
#include <SD.h>
#include "SDCommunicationLink.h"
#include <Time.h>
unsigned long epoch = 0;
DuplexCommunicationLink link(4, 3);
void setup()
{
pinMode(3,INPUT);
link.open();
}
void loop()
{
if (digitalRead(1) == HIGH)
{
epoch = nu();
}
send(epoch);
}
unsigned long nu()
{
return epoch + millis();
}
void send (unsigned long t)
{
link.write(t & 0xFF);
link.write((t >> 8)&0xFF);
link.write((t >> 16)&0xFF);
link.write((t >> 32)&0xFF);
}

the problem now is to get the data to an SD-card, how do i send my data to my SD-card. Wha functions can i use in order to send the data.

Thank you in advance!

Are you really shifting the data by 8) bits?

There are some posts at the top of this forum that you were supposed to read BEFORE you posted stupid looking code.

the problem now is to get the data to an SD-card, how do i send my data to my SD-card.

What SD card reader/writer do you have? How is it connected? Do you KNOW that it works? If the answer to the last question is yes, then clearly you have a library that you are using, so you should have seen the examples that come with the library.