I am really new to arduino. At the moment Iam doing a projekt to logg temeratur data in an SD card. So far the Temperatur control and displaying data via spi on my LCD 5110 works fine. Next step is to implement the logging. Well, I downloades severell librarys for SD card.
But not only one example of all those librarys did work.
Since I only want to collect data I don't need a library which provides me with a lot of Funktions.
So what I found is FileLogger lib and Fat16lib.
If I try to run the FileLogger lib example I get this error message:
In file included from ....mmc.h:53,
from .....FileLogger.h:22,
from FileLoggerDemo.pde:17:
.../Spi.h:36: error: 'byte' has not been declared
.../Spi.h:37: error: 'byte' does not name a type
...Spi.h:38: error: 'byte' does not name a type
In file included from ..../FileLogger.h:22,
from FileLoggerDemo.pde:17:
.../mmc.h:62: error: 'byte' does not name a type
..../mmc.h:63: error: 'byte' does not name a type
..../mmc.h:64: error: 'byte' does not name a type
..../mmc.h:137: error: 'byte' does not name a type
..../mmc.h:151: error: 'byte' does not name a type
..../mmc.h:166: error: 'byte' does not name a type
In file included from ...../FileLogger.h:23,
from FileLoggerDemo.pde:17:
..../nanofat.h:39: error: 'byte' does not name a type
..../nanofat.h:40: error: 'byte' does not name a type
.
.
.
.
In file included from FileLoggerDemo.pde:17:
..../FileLogger.h:32: error: 'byte' has not been declared
FileLoggerDemo.pde: In function 'void loop()':
FileLoggerDemo:45: error: cannot convert 'byte*' to 'int*' for argument '2' to 'int FileLogger::append(const char*, int*, long unsigned int)'
FileLoggerDemo:57: error: cannot convert 'byte*' to 'int*' for argument '2' to 'int FileLogger::append(const char*, int*, long unsigned int)'
Does someone of you know how to solve these errors?
I would be really glad, because I am searching already a long time in the internet and I can't get it solved.
Thanks!!
here is the example code which comes with the lib.
//
// Title : FileLogger library for Arduino, example code
// Author : Eduardo Garc?a (egarcia@stream18.com)
// Date : April 2009
// Id : $Id: FileLoggerDemo.pde 24 2009-04-23 22:45:13Z stream18 $
//
// DISCLAIMER:
// The author is in no way responsible for any problems or damage caused by
// using this code. Use at your own risk.
//
// LICENSE:
// This code is distributed under the GNU Public License
// which can be found at http://www.gnu.org/licenses/gpl.txt
//
#include "FileLogger.h"
// define the pin that powers up the SD card
#define MEM_PW 8
// variable used when reading from serial
byte inSerByte = 0;
#define MESSAGE "Hello, this is my message. Just testing the FileLogger library.\r\n"
unsigned long length = sizeof(MESSAGE)-1;
byte buffer[] = MESSAGE;
void setup(void) {
pinMode(MEM_PW, OUTPUT);
digitalWrite(MEM_PW, HIGH);
Serial.begin(9600);
}
void loop(void) {
char command = '0';
unsigned long t1, t2;
// Arduino expects one of a series of one-byte commands
if (Serial.available() > 0) {
int result;
inSerByte = Serial.read();
switch (inSerByte) {
case 'W':
result = FileLogger::append("data.log", buffer, length);
Serial.print(" Result: ");
if( result == 0) {
Serial.println("OK");
} else if( result == 1) {
Serial.println("Fail initializing");
} else if( result == 2) {
Serial.println("Fail appending");
}
break;
case 'T':
for(int i=0; i<10; i++) {
result = FileLogger::append("data.log", buffer, length);
Serial.print(" Result: ");
if( result == 0) {
Serial.println("OK");
} else if( result == 1) {
Serial.println("Fail initializing");
} else if( result == 2) {
Serial.println("Fail appending");
}
}
Serial.print("Done");
break;
}
}
}
That library has not been updated for 1.0+ use. If you want to go that route, change WProgram.h in FileLogger.h and mmc.h to Arduino.h. But, I don't think that that is going to prove an easy upgrade.
The Spi.h file defines a class called SPI that will conflict with the default SPI library.
The core SD library or the SdFat library are far better choices. If you have issues with them, addressing those issues is going to be easier.
/*
* Write Example
*
* This sketch creates a new file and writes 100 lines to the file.
* No error checks on write in this example.
*/
#include <Fat16.h>
#include <Fat16util.h> // use functions to print strings from flash memory
SdCard card;
Fat16 file;
// store error strings in flash to save RAM
#define error(s) error_P(PSTR(s))
void error_P(const char* str) {
PgmPrint("error: ");
SerialPrintln_P(str);
if (card.errorCode) {
PgmPrint("SD error: ");
Serial.println(card.errorCode, HEX);
}
while(1);
}
/*
* Write an unsigned number to file
*/
void writeNumber(uint32_t n) {
uint8_t buf[10];
uint8_t i = 0;
do {
i++;
buf[sizeof(buf) - i] = n%10 + '0';
n /= 10;
} while (n);
file.write(&buf[sizeof(buf) - i], i); // write the part of buf with the number
}
void setup(void) {
Serial.begin(9600);
Serial.println();
PgmPrintln("Type any character to start");
while (!Serial.available());
// initialize the SD card
if (!card.init()) error("card.init");
// initialize a FAT16 volume
if (!Fat16::init(&card)) error("Fat16::init");
// create a new file
char name[] = "WRITE00.TXT";
for (uint8_t i = 0; i < 100; i++) {
name[5] = i/10 + '0';
name[6] = i%10 + '0';
// O_CREAT - create the file if it does not exist
// O_EXCL - fail if the file exists
// O_WRITE - open for write
if (file.open(name, O_CREAT | O_EXCL | O_WRITE)) break;
}
if (!file.isOpen()) error ("file.open");
PgmPrint("Writing to: ");
Serial.println(name);
// write 100 line to file
for (uint8_t i = 0; i < 100; i++) {
file.write("line "); // write string from RAM
writeNumber(i);
file.write_P(PSTR(" millis = ")); // write string from flash
writeNumber(millis());
file.write("\r\n"); // file.println() would work also
}
// close file and force write of all data to the SD card
file.close();
PgmPrintln("Done");
}
void loop(void) {}
I have following issues:
...\libraries\Robot_Control\ArduinoRobot.cpp: In constructor 'RobotControl::RobotControl()':
...\libraries\Robot_Control\ArduinoRobot.cpp:8: error: 'LCD_CS' was not declared in this scope
...\libraries\Robot_Control\ArduinoRobot.cpp:8: error: 'DC_LCD' was not declared in this scope
...\libraries\Robot_Control\ArduinoRobot.cpp:8: error: 'RST_LCD' was not declared in this scope
...\libraries\Robot_Control\ArduinoRobot.cpp: In member function 'void RobotControl::begin()':
...\libraries\Robot_Control\ArduinoRobot.cpp:18: error: 'MUXA' was not declared in this scope
...\libraries\Robot_Control\ArduinoRobot.cpp:18: error: 'MUXB' was not declared in this scope
...\libraries\Robot_Control\ArduinoRobot.cpp:18: error: 'MUXC' was not declared in this scope
...\libraries\Robot_Control\ArduinoRobot.cpp:18: error: 'MUXD' was not declared in this scope
...\libraries\Robot_Control\ArduinoRobot.cpp:19: error: 'MUX_IN' was not declared in this scope
...\libraries\Robot_Control\ArduinoRobot.cpp:22: error: 'BUZZ' was not declared in this scope
...\libraries\Robot_Control\ArduinoRobot.cpp:25: error: 'Serial1' was not declared in this scope