I downloaded "dataflash_intro" and associated library files from the playground. I have installed a AT45DB011D on my shield and wired it correctly, changed the pin numbers in "dataflash.h". I've been trying to get "dataflash_intro to compile for about three days and there are 19 errors all related to "dataflash.h". Here are a few:
"Dataflash" has not been declared.
ISO C++ forbids declaration of "Dataflash" with no type
"Dataflash" is not a class or namespace
'void init ()'
"OUTPUT" was not declared in this scope
The file "dataflash.h" has only had the pin assignments changed to match the ATmega 2560. The rest of the code is as downloaded and is quoted as being in C++.
Here is the code from the Arduino Playground. And, here is the link where the library can be downloaded: Arduino Playground - Dataflash
#include <dataflash.h>
int lastpage=0; //last page written to
int pages=25; //total pages that will be used
Dataflash dflash;
void setup()
{
Serial.begin(115200);
Serial.print('h',BYTE);
Serial.print('i',BYTE);
Serial.print('\n',BYTE);//debug
dflash.init(); //initialize the memory (pins are defined in dataflash.cpp
}
void loop()
{
int j = 0;
int i = 0;
char messageline[] = "this is only a test on page: ";
char lpstring[] = "lastpage: ";
char int_string[10];
itoa(lastpage, int_string, 10); // make string of the pagenumber
strcat(messageline, int_string); //append to the messagline string
//for (int i=0; messageline != '\0'; i++)
_ while (messageline != '\0')_ * {* _ Serial.print(messageline*, BYTE); //just a check to see if the loop is working* dflash.Buffer_Write_Byte(1, i, messageline*); //write to buffer 1, 1 byte at the time* * j = i; i++; } i=0;_ dflash.Buffer_Write_Byte(1, j+1, '\0'); //terminate the string in the buffer* * Serial.print('\t');* * dflash.Buffer_To_Page(1, lastpage); //write the buffer to the memory on page: lastpage* * strcat(lpstring, int_string); _ for(int i=0; lpstring != '\0';i++) {_ dflash.Buffer_Write_Byte(2, 20, lpstring); //write to buffer 2 the lastpage number that was used* _ Serial.print(lpstring*); //write to serial port the lastpage number written to* * } Serial.println(); lastpage++; if (lastpage > pages) //if we reach the end of the range of pages* * { lastpage = 0; for (int i=0;i<=pages;i++) {_ dflash.Page_To_Buffer(i, 1);//copy page i to the buffer* * for(int j=0;j<32;j++) //32 depends on the amount of data on the page* * // testing for a specific charater is also possible* * {* * Serial.print(dflash.Buffer_Read_Byte(1, j)); //print the buffer data to the serial port* * }* * Serial.print(" page: ");* * Serial.println(i); //print the last read page number* * }* * }* * delay(200); //slow it down a bit, just for easier reading* }
Ok. I just downloaded it all, installed the library in the correct place, changed the WConstants.h reference in the library to Arduino.h, replaced the Serial.print(x,BYTE) statements in the sketch, and it compiled fine.
OK, I found the library files were incorrectly named, changed "dataflash.h" to "flash.h" and all references to it. Then, I saved "Dataflash.cpp" as "dataflash.h". Also, I found the info on changing to <arduino.h>, but, what do you Change for BYTE. I tried "char" and I still get a "expected primary expression before char" error on compile. Thanks for your help in getting me going in the right direction.
WHat version of arduino are you using? Because I cant get this working for the life of me.
The psychic that we hired has not started yet. The tentative start data is the 12th of never. If you need help before then, you need to provide some more details. Like what version of the IDE you are using, and why you can't get it working - like any compiler error messages.
this is only a test on page: 0 page: 0
this is only a test on page: 1 page: 1
this is only a test on page: 2 page: 2
this is only a test on page: 3 page: 3
this is only a test on page: 4 page: 4
this is only a test on page: 5 page: 5
this is only a test on page: 6 page: 6
this is only a test on page: 7 page: 7
this is only a test on page: 8 page: 8
this is only a test on page: 9 page: 9
this is only a test on page: 10 page: 10
this is only a test on page: 11 page: 11
this is only a test on page: 12 page: 12
this is only a test on page: 13 page: 13
this is only a test on page: 14 page: 14
this is only a test on page: 15 page: 15
this is only a test on page: 16 page: 16
this is only a test on page: 17 page: 17
this is only a test on page: 18 page: 18
this is only a test on page: 19 page: 19
this is only a test on page: 20 page: 20
this is only a test on page: 21 page: 21
this is only a test on page: 22 page: 22
this is only a test on page: 23 page: 23
this is only a test on page: 24 page: 24
this is only a test on page: 25 page: 25
this is only a test on page: 0 lastpage: 0
this is only a test on page: 1 lastpage: 1
this is only a test on page: 2 lastpage: 2
this is only a test on page: 3 lastpage: 3
this is only a test on page: 4 lastpage: 4
this is only a test on page: 5 lastpage: 5
this is only a test on page: 6 lastpage: 6
this is only a test on page: 7 lastpage: 7
this is only a test on page: 8 lastpage: 8
this is only a test on page: 9 lastpage: 9
this is only a test on page: 10 lastpage: 10
this is only a test on page: 11 lastpage: 11
this is only a test on page: 12 lastpage: 12
this is only a test on page: 13 lastpage: 13
this is only a test on page: 14 lastpage: 14
this is only a test on page: 15 lastpage: 15
this is only a test on page: 16 lastpage: 16
this is only a test on page: 17 lastpage: 17
this is only a test on page: 18 lastpage: 18
this is only a test on page: 19 lastpage: 19
this is only a test on page: 20 lastpage: 20
this is only a test on page: 21 lastpage: 21
this is only a test on page: 22 lastpage: 22
this is only a test on page: 23 lastpage: 23
this is only a test on page: 24 lastpage: 24
this is only a test on page: 25 lastpage: 25