Stalker+GPS Bee

Hi all,

I got a stalker the other day and I managed to get all the standalone demos going without a hitch (GPS log, RTC log and so on works without a hitch) so now I need to add some functionality. I’m a little foggy on how the GPS Bee and the stalker logs the data. From what I can tell, there is a buffer created to store 128 bits and this is written to the SD card as it fills up - or am i mistaken in someway?

what I was trying to do, just as a start was to integrate the reading of A0 as a temp sensor (as in the RTC demo) and write that to the SD with the GPS data - but of course my trial doesn’t work - maybe I need to define an additional buffer?

here’s what I’ve tried:

[code]/*===========================================================

Seeeduino Stalker Demo code – www.seeedstudio.com
Copyright © 2009-2010 Seeedstudio
This is a demo code for Seeeduino Stalker. It use the hardware
Uart interface to read the date from a GPSBee , and save these
GPS date into the SD card.
You need to download and setup the FileLogger library befor you
use this code.You can download it here :
http://www.seeedstudio.com/depot/images/produce/FileLogger.rar
And you need to add a data.log in your SD Card .

12.22.2009 FreeZinG
===========================================================*/

#include “FileLogger.h”
#define Idle 0
#define Accept 1
#define Record 2

byte start[7]= { ‘B’,‘e’,‘g’,‘i’,‘n’,0x0d,0x0a};
byte buffer[128];
unsigned char result;
unsigned char state;
unsigned long ptr;

// below is adde to record from analog 0 pin
int temp;
byte ASCII[10]={‘0’,‘1’,‘2’,‘3’,‘4’,‘5’,‘6’,‘7’,‘8’,‘9’};

void setup(void)
{
Serial.begin(9600);//start Uart with GPS
result = FileLogger::append(“data.log”, start, 7);
while(result) result = FileLogger::append(“data.log”, start, 7);
}

void loop(void)
{
switch(state)
{
case Idle: // just idle
if (Serial.available()>0) state=1;
break;

case Accept: // receive data from GPS and save in buffer

//inserted to read analog0

   temp=analogRead(0);
 buffer[15]=ASCII[(temp/100)];
 buffer[16]=ASCII[((temp%100)/10)];
 buffer[17]=ASCII[(temp%10)];
 
 //to here

if (Serial.available()>0)
{ 
  buffer[ptr]=Serial.read();
  ptr++;
  if(ptr>127)// if more than 128Byte in buffer
  {
    state=Record;
  }
}
else
{ // receive end
  state=Record;
}
break;

case Record:// log the data in buffer into SD card
result = FileLogger::append(“data.log”, buffer, ptr);
if (result==0)
{
ptr=0;
state=Idle;
}
break;

default:
state=Idle;
break;

}

}

[/code]

Any pointers would be a huge help.

thanks
matthew