• Ic. Good practice is to put the actions into an onInit() function. To get it going on development time, you add a delayed invocation of it, like this:

    var hat = require('servo').connect(A0);
    var pos=0,t=null;
    function sweep(){
      hat.move(pos,500,function(){
        if(pos===0){pos=1;}else{pos=0;}
        t=setTimeout(function(){ sweep(); },1000);
        
      });
    }
    function onInt() {
      hat.move(0.5, 1000, sweep)
    }
    
    // for convenience while developing:
    setTimeout(onInit, 1000);
    

    Adding the last line simulates a power on with saved code, and you do not have to enter that in the console every time after upload. When you are done with development, the last line is removed just before saving the code.

    That of course does not solve the positioning issue...

About

Avatar for allObjects @allObjects started