Go Down

Topic: Writing to a file in the setup() function (Read 735 times) previous topic - next topic

Team3

Hey everyone,
  How can I create/read/write to a file within the setup() function? I am using the Arduino BT and am new to this and having a hard time.
Thanks.

-Team3

Grumpy_Mike

I think you have not got your embedded head on. We don't write to files on this platform. We can do serial print or store things in arrays or variables but files no. Where is the file going to be stored?
Unless you go for an external memory shield there is no place to put a file.

YenTheFirst

Grumpy_Mike is entirely right, the arduino itself doesn't really have files.

If you wanted to have the arduino hooked up to a computer, and save files on that computer, you'll have to write a seperate program on the computer and interface them together. See http://www.arduino.cc/playground/Main/InterfacingWithSoftware

If you were planning on having the arduino stand alone, and keep some data 'permanently' (between power cycles), you can write a tiny bit of data to the EEPROM. see http://www.arduino.cc/en/Tutorial/Memory and http://www.arduino.cc/en/Reference/EEPROM

If you wanted to have a memory card attached to the arduino, that would require interfacing with that card.

What is it that you're trying to do?

florinc

Check this out:
http://timewitharduino.blogspot.com/2009/05/getting-arduino-to-write-to-or-read.html

It does not matter if the "read/write" is inside setup() or inside loop(), as long as Serial.begin() was called before you start calling Serial.print().

I hope this is what you are looking for.


Go Up