As previously mentioned code would help; however, the serial text is a subset of the original which would indicate data being dropped, either in the serial transmission to the computer or possibly in your code reading the SD card.

New true random number library available at: http://code.google.com/p/avr-hardware-random-number-generation/

Ha, I just rewrote the code and it works. Not sure what it was as the code is mostly just the example sketch.

One question, this code is printing to serial using Serial.write, not Serial.print. As I understand it this is because the data is in binary form. Given this, how do I assign the text (ascii) contents of this file to a string?

void setup(){ Serial.begin(9600); Serial.print("Initializing SD card..."); // On the Ethernet Shield, CS is pin 4. It's set as an output by default. // Note that even if it's not used as the CS pin, the hardware SS pin // (10 on most Arduino boards, 53 on the Mega) must be left as an output // or the SD library functions will not work. pinMode(53, OUTPUT);

Additionally, write() can also send null terminated strings, if you provide a char* parameter.Serial.print() and println() are rather convenience methods to format various data types into readable text.

To read longer texts from a file into variables you have to take care where to store it ( and how long ), as Arduino RAM is very limited.

The sample code does not store it at all, but simply uses every read character just as output parameter to Serial.write(). This way, it can handle files of any length.

See my question: "Problem with DmxSimple.h". My code does exactly what you want and then even parses the lines of text. Of course it seems to be un-usable when including DmxSimple.h but that is another topic :-)

Well a popular thing to do I guess :-). Thanks to pylon my code now works. I have placed a lot of the debug messages in comments aqnd now the codes works fine even with the include DmxSimple.h You can clean it up as this was my "test and debug" version but it does what it should. You'll still have top add the proper calls to DmxSimple but at least the lines are parsed correctly and are available in an array.

//Card will Draw Power from Pin 8, so set it high //Strange Arduino Idea... Arrrrggghhh them Software Designer they're so naughty! //This May not survive in Final Design //pinMode(PowerPin, OUTPUT); //digitalWrite(PowerPin, HIGH);

// As long as there are characters and that the Index is less than 80 characters read the file while(CSVCommandFile.available() && (IterationCounter <= 79)) { IntermediateBuffer = CSVCommandFile.read(); // Look for the first exception, 0x0D or carriage return. May be absent in a Mac generated CSV file if (IntermediateBuffer == 0x0D) { continue; // If found, re-iterate the while loop } // Look for the second exception, 0x0A or line feed else if (IntermediateBuffer == 0x0A) { CSVStringBuffer[IterationCounter] = NULL;

I want to read in the text "46,110,173,237;"and store it as a String "46,110,173,237;"

Then it's slightly different to pshoule's approach ...

I guess your rules are: - There are max 16 characters ( 4*3 digits + separators ). So define a char text[17]; as minimum for those characters and a trailing 0 end indicator.- The last one is the only semicolon ( ';' ) in the file, and it's always there as an end indicator. (If you're at the end of the provided space, treat it as a wrong file) - There are no line feed ( 0x0A ) or carriage return (0x0D) characters in the file before the semicolon. (If there are, treat it as a wrong file)

If you were interested in the numbers, there were other rules, of course. ...and pshoule's approach was worth having a closer look

You just want to read a character, store it in your text array at the correct location and check if all is still ok. If ok and no end indicator found yet, do it again with another character to the next location.When done, add a trailing 0 after the last character you just stored ( the ';' ), so that Serial.println(text); works well.

Is it possible to just send single bytes in sequence with a delimiter at the end?

If so, how would these appear in a text file? I'm using another piece of software to generate the text files and make it do anything. I'm just not sure what a single byte should 'look like'

Sure, it's not a text file any more but some binary file, without any structure.You cannot read it with notepad, but it would open and read in your sketch were the same.Every byte you read would have a specific meaning.

This would reduce each file size by 75%, which would be great as I'm trying to send lots of values very quickly.

File size does not really matter, and won't affect speed too much, I think. It's not a Serial connection at 2400 baud.What is "lots of values" ? You cannot store 2k bytes in an Arduino UNO anyway. If it's 200 bytes, it does not really matter if the file size is 200 or 1000 bytes.I've got a very old SD card of 32 MB, which is horribly oversized for my Arduino project.

As a compromise: what about storing the data as hex strings. perhaps without comma delimiters but newline to structure it and make it readable?

"46,110,173,237;" would become"2E6EADED"

Readable in a text editor, and easily convertible to binary in Arduino.

I've created text files, each one representing one 'frame' of 512 8bit values. The plan is to read these load each frame into arduino ram, update these 512 values (which get sent as dmx), then load the next frame.

I need to read 512 8bit values at as close to 30 fps as possible.

Below is the test code I'm using to open then close 30 of these text files

void setup(){ Serial.begin(57600); Serial.print("Initializing SD card..."); // On the Ethernet Shield, CS is pin 4. It's set as an output by default. // Note that even if it's not used as the CS pin, the hardware SS pin // (10 on most Arduino boards, 53 on the Mega) must be left as an output // or the SD library functions will not work. pinMode(53, OUTPUT);