Go Down

Topic: Run programs from SD card according to command received from Serial (Read 224 times) previous topic - next topic

AC_BTW

Hello,

I am working on a project in which I want to have an Arduino Pro Mini in 2 functionning modes according to the command received from Serial via Bluetooth.

For that, I wrote a program that should behave the way I want but my sketch is too big to be uploaded.. This leaded me to write 2 programs, one for each mode, that I can upload to my Arduino when I want to switch from one mode to another but it is not what I initially wanted to do.

This is why my question is: as I am using an SD card, is it possible to store those 2 programs into the SD card and then run either program according to the command received from Serial?

I have seen several projects in which a bootloader is used to run a program from an SD card using 2 Arduinos or when the reset button is pressed but it is not exactly what I want to do.

Thanks for your help

Zapro

What is taking up so much space in your sketches? If it's a lot of variables, you could put them into flash. If flash if full you could have the data you need in a textfile on SD-card that is read on demand.

// Per.

AC_BTW

I have put as many variables as possible in the flash already but as I said the problem comes from the flash that is full with my main program. I believe that what takes up a lot of space is the SD.h library and the reading/writing of data in the SD card.

Anyway, my question remains: if I have several programs stored into my SD card, is it possible to choose to run either program according to the command received from the Serial?

robtillaart

You could put a script interpreter in the ARduino and scripts on the SD card. It will be slower but I know it is doen in the past but I do not have a link to that interpreter application, sorry.
Rob Tillaart

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

robtillaart

check this - https://arduino.stackexchange.com/questions/19489/load-arduino-flash-code-from-sd-card

(never tried, all disclaimers apply :)

Rob Tillaart

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

dunk8

2boots Works ok,that loads from sd card.just Google 2boots.

Go Up