-->
Page 1 of 2

Only one sketch - right?

PostPosted: Fri Sep 15, 2017 9:28 am
by liderbug
I think I'm about to graduate - or at least move up a grade...

I'm thinking you can only load "1" sketch. It starts with "setup" (init) and "loop" (run) and you have to put everything you want to do in that one package.

(although I'm thinking someone has or is going to write a base sketch that will do "X" and also load "Y1" into another part of memory, X never stops, then loads "Y2" over Y1 ...) (been there).

Re: Only one sketch - right?

PostPosted: Fri Sep 15, 2017 10:31 am
by rudy
Normally it is only one program that can be loaded. But I recall someone that had their current code load a new program out of SPIFFS and replace the current code. And as long as each newly loaded program has the loader program it can continually switch programs as required. Complicated but doable.

Unless this was just part of a dream. Or a dream within a dream. (hate those)

Re: Only one sketch - right?

PostPosted: Fri Sep 15, 2017 12:47 pm
by liderbug
Where my mind went ... some time back (we won't discuss dates) I was the programmer on a DEC PDP-7 - had a 8k core memory, the OS (which used 6k of the 8k) idled in a loop of 10 nop's with a jmp -10 at the end. I experimented with telling the system to read in from paper tape what was in effect a subroutine. The last line of code on the tape was a 'call progstart'.
so we had: nop, nop, nop, nop, sub(); nop, nop, nop, nop, nop, jmp -10
programstart just compiled any keystrokes and if they matched a case it continued on into the sub-program, if not then back to the wait loop. When the program finished it put a "nop" over the sub() in the loop.

Montana Large Aperture Seismic Array (12 yrs)

Re: Only one sketch - right?

PostPosted: Tue Sep 19, 2017 11:06 pm
by liderbug
Hmmm, couple of days later... a base wifi program that will accept a secondary program - which is is the real program. You load the base and deploy to the roof/garage/40' up a pole... Then via wifi load the TMP36 software - the windspeed sw - the xyz sw - all without having to go retrieve, connect, reprogram and re-climb the 40' pole. Just http://192.168.86.22/push_new_version. :?: