An archive of as of Saturday January 26, 2019.

%%Compiler error [can’t ‘create’ a local slot]


I can't seem to get the last RPC example of the Esquilo Documentation working. I included require system in the nut. If I comment out the line that says "lastSet<-time()" I do not get the error. I have verified that time() is being retrieved by creating local time=time() and seeing it displayed in the console. Any suggestions? Here is the squirrel snippet from the documentation. Thank You.

// Squirrel snippet
lastSet <- time();
function ledStatus()
return { state=led.islow(), time=(time() - lastSet) };


Hi, try this:


lastSet <- time();

function ledStatus()
    return { state=true, time=(time() - lastSet) };

while(true) {

You need the require("system") for time()
The led.islow() really needs more code from a GPIO pin which is beyond this example so I just set it as true.

You need a loop to keep the nut running, just added a delay to show that you can do other things in there while the program is running.

Probably not the best example but this should work, tested it. Didn't change anything in the html file.


<!-- HTML/JavaScript snippet -->
<p>The LED has been <span id="ledState"></span> for <span id="ledTime"></span> seconds.</p>
<script type="text/javascript" src="/js/erpc.js"></script>
  erpc("ledStatus", null, function(status) {
    ledState.innerText = status.state ? "on" : "off";
    ledTime.innerText = status.time;

You can use a url of the Esquilo ip with /sd/path to html file.
For example mine is:

It displays this, ran it several times though and the seconds will get larger.

The LED has been on for 20 seconds.

Hope this helps,



Thanks for the help. I was working on that for a long time and had to ask someone so I could get around it. I had placed the nut code inside of a while(true) loop. That didn't work well. After moving the snippet outside of the while(true) loop the innerHTML would read off and on fine but the seconds continue to go up. So the final result is

The led has been on for 45 seconds
The led has been off for 52 seconds
The led has been on for 59 seconds

and so on.

The time doesn't reset to 0 during an "off to on" or "on to off" transition like I thought. I guess I assumed it would by the wording of the sentence. I think I need to add some code to set lastSet to 0 during a transition. Are you getting the same result when your GPIO input is actually changed back and forth from off to on? Thanks again.