• As DrAzzy says, you need:

    var self = this;


    self = this;

    That's almost certainly your problem... Personally though I'd also skip defining the small second function, and do:

    var self = this;
      this.interval = setInterval(function ()  {
    //    print(self.pin);
      }, 20);

    That's the pattern we tend to use for modules, and while it involves writing self and not this, it is a bit more efficient both in speed and memory usage.


Avatar for Gordon @Gordon started