Newbie Questions - magnetic reader project,

so im working on making a magnetic card reader that writes what you swipe to a sd card or outputs it to a bluetooth or gsm shield , i have the code for the magnetic writer it works , but it prints to a volatile buffer that will only store and display one data entry , i wish for it to log all of them in either plain text on a sd card , or output every entry to a gsm module then to a phone number as text message or via bluetooth where it would store all the data entrys till it was syncd with a bluetooth device then it would download them all ... is this feasible ? i dont think im far off but my knowledge is coming from the arduino for dummies and java for dummies text books and i think i need help, if you can point me in the right direction or would like to help that would be amazing

Hook your code in instead of the “store and display one data entry”. You can write (log) every message to a SD card, and transmit that file at any time. Most probably you’ll have to close the log file before a transmission, and open a new file for logging.

so i would tell it to serial print to the sd card? im trying to learn this as i go :p

See the examples in File->Examples->SD. There is even one called "Datalogger" which should give you some good ideas.

To send via SMS, look at the examples in File->Examples->GSM. There is even one called "SendSMS" which should give you some good ideas.

in the setup code this is the bit related to the buffer

int cld1Pin = 4; // Card status pin
int rdtPin = 2; // Data pin
int reading = 0; // Reading status
volatile int buffer[400]; // Buffer for data
volatile int i = 0; // Buffer counter
volatile int bit = 0; // global bit
char cardData[40]; // holds card info
int charCount = 0; // counter for info
int DEBUG = 0;

void setup() {

well actually thats all of it but

and this i believe is related to printing to the buffer , i kind of understand how the sd library works , do i just change the datalogger example to read from the digital pins im using to read off the card readeR?

Serial.begin(9600);

// The interrupts are key to reliable
// reading of the clock and data feed
attachInterrupt(0, changeBit, CHANGE);
attachInterrupt(1, writeBit, FALLING);

}

void loop(){

// Active when card present
while(digitalRead(cld1Pin) == LOW){
reading = 1;
}

// Active when read is complete
// Reset the buffer
if(reading == 1) {

if (DEBUG == 1) {
printBuffer();
}

decode();
reading = 0;
i = 0;

int l;
for (l = 0; l < 40; l = l + 1) {
cardData[l] = ‘\n’;
}

charCount = 0;
}
}

// Flips the global bit
void changeBit(){
if (bit == 0) {
bit = 1;
} else {
bit = 0;
}
}

// Writes the bit to the buffer
void writeBit(){
buffer = bit;

  • i++;*
    }

// prints the buffer
void printBuffer(){

  • int j;*
  • for (j = 0; j < 200; j = j + 1) {*
  • Serial.println(buffer[j]);*
  • }*
    }

int getStartSentinal(){

  • int j;*

  • int queue[5];*

  • int sentinal = 0;*

  • for (j = 0; j < 400; j = j + 1) {*

  • queue[4] = queue[3];*

  • queue[3] = queue[2];*

  • queue[2] = queue[1];*

  • queue[1] = queue[0];*

  • queue[0] = buffer[j];*

  • if (DEBUG == 1) {*

  • Serial.print(queue[0]);*

  • Serial.print(queue[1]);*

  • Serial.print(queue[2]);*

  • Serial.print(queue[3]);*

  • Serial.println(queue[4]);*

  • }*

  • if (queue[0] == 0 & queue[1] == 1 & queue[2] == 0 & queue[3] == 1 & queue[4] == 1) {*

  • sentinal = j - 4;*

  • break;*

  • }*

  • }*

  • if (DEBUG == 1) {*

  • Serial.print(“sentinal:”);*

  • Serial.println(sentinal);*

  • Serial.println("");*

  • }*

  • return sentinal;*
    }