Hi,
I am just starthing to get to grips with my Stalker - not getting any joy yet & wondering if a little help might be in order?
So this is what I have done:
Downloaded the sample code and opened in Arduino.
Downloaded the DS1307.H library (not in location indicated by demo code - got it from Seeeduino DS1307 page)
Downloded the FileLogger.H library (not in location indicated by demo code - got it from Seeeduino SD Card Shield page)
Formated the mSD card on a Canon camera and inserted.
Created an empty data.log file on the card.
Compiled the code onto the stalker via Arduino 0017/ATmega 168 - all transferred fine.
Waited several minutes and checked data.log for content.
The only error I got was when adding the FileLogger.H library: you may need to use Tools -> Fix Encoding & Reload to update
the sketch to use UTF-8 encoding. If not, you may need to delete the bad characters to get rid of this warning.
I ran the Fix Encoding & Reload tool and as far as I can tell that fixed the problem.
It all looks like it should be working but no data is getting recorded.
Any help would be appreciated.
[code]
/*===========================================================
Seeeduino Stalker Demo code – www.seeedstudio.com
Copyright © 2009-2010 Seeedstudio
This is a demo code for Seeeduino Stalker. It record the sensor
data into SD Card every 5 seccond .
In this demo code , it include two library : FileLogger and DS1307.
You can download these two library here:
http://www.seeedstudio.com/depot/images/produce/FileLogger.rar
http://www.seeedstudio.com/depot/images/produce/DS1307.rar
Remenber to add a data.log file in your SD Card first.
12.22.2009 FreeZinG
===========================================================*/
#include “FileLogger.h”
#include “DS1307.h”
#include <WProgram.h>
#include <Wire.h>
#define Timing 0
#define Accept 1
#define Record 2
byte start[7]= { ‘B’,‘e’,‘g’,‘i’,‘n’,0x0D,0x0A};
byte buffer[20];
int temp;
byte ASCII[10]={‘0’,‘1’,‘2’,‘3’,‘4’,‘5’,‘6’,‘7’,‘8’,‘9’};
unsigned char result;
unsigned char state;
int time=0;
int oldtime=0;
void setup(void)
{
result = FileLogger::append(“data.log”, start, 7);//Initial the SD Card
while(result) result = FileLogger::append(“data.log”, start, 7);
RTC.stop();
RTC.set(DS1307_MIN,30); //set the minutes
RTC.set(DS1307_HR,10); //set the hours
RTC.set(DS1307_DATE,22); //set the date
RTC.set(DS1307_MTH,12); //set the month
RTC.set(DS1307_YR,9); //set the year
RTC.start();
}
void loop(void)
{
switch(state)
{
case Timing:
time=RTC.get(DS1307_SEC,true);
delay(200);
if(time!=oldtime)
{
oldtime=time;
temp=RTC.get(DS1307_MTH,false);
buffer[0]=ASCII[(temp/10)];
buffer[1]=ASCII[(temp%10)];
buffer[2]='-';
temp=RTC.get(DS1307_DATE,false);
buffer[3]=ASCII[(temp/10)];
buffer[4]=ASCII[(temp%10)];
buffer[5]='-';
temp=RTC.get(DS1307_HR,false);
buffer[6]=ASCII[(temp/10)];
buffer[7]=ASCII[(temp%10)];
buffer[8]='-';
temp=RTC.get(DS1307_MIN,false);
buffer[9]=ASCII[(temp/10)];
buffer[10]=ASCII[(temp%10)];
buffer[11]='-';
//temp=RTC.get(DS1307_SEC,false);
buffer[12]=ASCII[(time/10)];
buffer[13]=ASCII[(time%10)];
buffer[14]=':';
state=Accept;
}
break;
case Accept:
temp=analogRead(0);
buffer[15]=ASCII[(temp/100)];
buffer[16]=ASCII[((temp%100)/10)];
buffer[17]=ASCII[(temp%10)];
buffer[18]=0x0D;
buffer[19]=0x0A;
state=Record;
break;
case Record:
result = FileLogger::append(“data.log”, buffer, 20);
if (result==0)
{
state=Timing;
}
break;
default:
state=Timing;
break;
}
}[/code]