simple code help(job help please)

Posted on
  • Hello, I want the puck.js to light up after a certain distance or steps , lets say 20 steps. So once this distance has been reached I want the puck to light up green

  • Hi,

    I guess this isn't really something you wanted to pay someone for? In which case it should really go on the Puck.js forum - I'll move it.

    Based on­meter-gyro

    var steps = 0;
    Puck.on('accel',function(a) {
      if (steps>20) LED2.set();

    And maybe you want to reset it too when you press the button., so you can add:

    setWatch(function() {
      steps = 0;
    }, BTN, {edge:"rising", repeat:true});
  • Thank you i appreciate it!!

  • Thank you

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

simple code help(job help please)

Posted by Avatar for user140491 @user140491