Go Down

Topic: Storing code? (Read 1 time) previous topic - next topic

Ccc56

Can I write a code for the arduino to read and execute a code from an SD card?

CrossRoads

Yes.
Define what you mean by execute.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Ccc56

Well the Arduino only has so much memory. I was wondering if I could save a large code on an SD card and just write a simple sketch telling the Arduino to run the code that is saved on the SD card.

CrossRoads

No, you can't run from SD card as if it were internal Flash.
You could move non-changing data from your code to the SD and access it as needed, reduce your sketch size.
You could probably write code (bootloader) to upload your program and then start your new sketch.  Has been discussed here, don't know if its ever been done.

Probably easier to get a processor with more memory. There a few of us working on 1284P based kind of Uno, lot more memory to play with there.
http://arduino.cc/forum/index.php/topic,56567.0.html
http://arduino.cc/forum/index.php/topic,61126.105.html
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

liudr

Lots of times you don't actually need that much memory unless you're doing a very large project, like 3,000 lines big or you're writing code very improperly. In case of very large project, use MEGAs with more space. In case of improper programming, redo your programming. I have several blog posts about optimizing your codes:

http://liudr.wordpress.com/category/coding/

You could share your code here so we can see which way to point you to.

Chicken325

So no one could write an Arduino interpreter in Arduino?  :)

robtillaart

Quote
So no one could write an Arduino interpreter in Arduino?


On contrary, it is done by these people: - http://bitlash.net/wiki/start -

As I have no experience with bitlash, I think you have to rewrite parts to read the commands from SDcard iso serial.

 
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

billroy

FYI/FWIW, I have posted a version of Bitlash that runs script from an SD card.  More at this post: http://arduino.cc/forum/index.php/topic,63126.0.html and at http://bitlash.net

Best,

-br
http://bitlash.net
http://entropymouse.com

Go Up