General pages
    • 6 Projects
    • 0 Albums
    Random Projects
    Random Albums
    No albums here yet
    Random Followers
    • larissa

    Recent Updates

    Pinned Items
    Recent Activities
    • Golf Trainer changed the cover photo
      Post is under moderation
      Stream item published successfully. Item will now be visible on your stream.
    • Use this code:

      // comment: simple counter
      var count = flow.get('count')||0;
      count += 1;
      flow.set('count', count);
      var send = { payload : count};
      return send;
      Post is under moderation
      Stream item published successfully. Item will now be visible on your stream.
    • Counter changed the cover photo
      Post is under moderation
      Stream item published successfully. Item will now be visible on your stream.
    • Detect Steps changed the cover photo
      Post is under moderation
      Stream item published successfully. Item will now be visible on your stream.
    • Try this as the code:

      // last measured value
      var measured = msg.payload;

      // calculate average (as comparison) with previous values
      var alpha = 0.05; // how much weight do we give the last measured value in our average?
      var avgPrev = flow.get('avgPrev')||0;
      var avgNow = alpha*measured + (1-alpha)*avgPrev;
      flow.set('avgPrev', avgNow);


      // compare measured value to average
      var sens = 0.2; // sensitivity (try 0.2 for motion, 0.02 for pulse)
      if (measured-avgNow>sens*avgNow) { // more than 20% larger? defines threshold event
      var send = { payload : "Step! Threshold was crossed"}; // output value from counter
      return send;
      }
      Post is under moderation
      Stream item published successfully. Item will now be visible on your stream.
    There are no activities here yet
    COM_EASYSOCIAL_POPBOX_ERROR_UNABLE_TO_LOAD_CONTENT
      © STEMgem