You are reading a single comment by @JumJum and its replies. Click here to read the full conversation.
  • Hello,
    I tried it (see source) and got memory usage of 199, which is close to 4k or 3k by subtracting 4 bytes/block. Sourcecode is less than 400 bytes only.
    Trace is not a help for me, my knowledge about that is too poor.
    Checked memory-usage:

    1. function Blinker only: usage is 60
    2. function Blinker with LED1: usage is 132
    3. function Blinker with LED1, LED2: usage is 199
    4. function Blinker with LED1, LED2, LED3: usage is 265
    5. used Blinker as module and required for LED1: usage is 178
    6. used Blinker as module and required for LED1, LED2: usage is 252
    7. used Blinker as module and required for LED1, LED2, LED3: usage is 326

      
      function Blinker(pin,frequency){
      var me = this;
      me.iv=-1;
      me.status = true;
      me.dur = 1000 / frequency;
      me.stop = function(){
      pin.write(false);clearInterval(me.iv);
      };
      me.start = function(){
      iv = setInterval(function(){
        me.status = !me.status;pin.write(me.status);
      },me.dur);
      };
      this.start();
      }
      var b = new Blinker(LED1,2);
      var c = new Blinker(LED2,5);
      
      
About

Avatar for JumJum @JumJum started