• Right now, I'm powering the Espruino via the USB and have the servo sharing the ground and powered via a separate 5v power supply like the docs recommend.

    Below is the code I'm using. It's pretty basic. I was just trying to test out the servo module.

    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);
        
      });
    }
    hat.move(0.5);
    sweep();
    
    
About

Avatar for Ken @Ken started