Tuesday, February 22, 2011

SDCARDmodded library

I was looking for raw SDcard code, of the type that does not create, write and/ or append files. I was looking for something simple that would allow me to increase the memory space of my arduino and would provide a simple interface to save bytes to the card.

There are quite a few SD card libraries but they are all way more complex than what I needed, but some days ago I came across the SDCARD library at the arduino forums. I love what carl47 writes in the forum:

It reads and writes directly to sectors on a sd card.
It's use is for mass storage on the arduino platform. 
It's not to store data and then load it(without a special program) to a PC.

It's a dream, exactly what I needed!

It had all I wanted but just a small problem: it defaulted to the basic SPI comms using D10 of the arduino as the SS pin. Furthermore, it used its own implementation of SPI comms. I needed to easily hange the SS pin to whatever Digital pin I wanted and I needed it all the work with the other SPI devices.

Because the other SPI devices are using the SPI library that comes with the arduino IDE, I had to change the SDCARD library to allow me to:

1. use the standard SPI.h lib instead of its own implementation
2. Allow me to use any digital pin

So I changed it to the SDCARDmodded library that you can download here (unzip, place folder on your arduino/libraries folder ans restart the IDE.

library tested with IDE022.

Have fun.

Wednesday, February 9, 2011

Location of Arduino's Build Directory

In case you're wondering, as I was, where does the arduino IDE save the .elf and .hex files and everything that it needs to compile your code, let me tell you it's here (for windows7 and  IDE 0022):


where the NNNNNNNNNNN is a sequence of numbers making up the .tmp directory. If you have a lot of things on the Temp folder, you may want to order it by "date modified" to quickly find your files.

Why is this important?

1. the .cpp.elf file will not show up on searches if it is on a Temp directory (I know, I looked and looked for it)
2. You need those files for things like Atmega emulators (see emulare for an arduino emulator - AtMega328, really - still trying to make the emulator work...)

Hope this helps.