mbl_mw_led_stop_and_clear not working in my example

I am very likely not doing something correctly, but i have this addon to help prototype via OpenFrameworks, the pattern i set via the function https://github.com/Mach1Studios/ofxMetaMotion/blob/main/src/metamotionController.cpp#L174 works great but I am unable to turn off this pattern in any way, for example this doesnt work: https://github.com/Mach1Studios/ofxMetaMotion/blob/main/src/metamotionController.cpp#L183

Any pointers or anything i am doing wrong would help!

Comments

  • edited June 2021

    You can use the reset() function if need be to turn off the LED.
    There is also a function to turn off the LED that you seem to be using but you must be using the call incorrectly somewhere. Not enough info to comment further.

  • edited June 2021

    Ok I checked today and the MetaWear.mbl_mw_led_stop_and_clear(device.board); function was working very well for me.

    var MetaWear = require('../index');
    
    MetaWear.discoverByAddress('c8:4b:aa:97:50:05', function(device) {
      console.log("DISCOVER BY ADDRESS DONE");
      device.connectAndSetUp(function (error) {
          console.log("CONNECT AND SETUP DONE");
          var pattern = new MetaWear.LedPattern();
          console.log("LOAD");
          MetaWear.mbl_mw_led_load_preset_pattern(pattern.ref(), MetaWear.LedPreset.BLINK);
          console.log("WRITE");
          MetaWear.mbl_mw_led_write_pattern(device.board, pattern.ref(), MetaWear.LedColor.GREEN);
          console.log("PLAY");
          MetaWear.mbl_mw_led_play(device.board);
          setTimeout(function () {
            device.on('disconnect', function () {
              console.log("DISCONNECT");
              process.exit(0);
            });
            console.log("STOP");
            MetaWear.mbl_mw_led_stop_and_clear(device.board);
            MetaWear.mbl_mw_debug_reset(device.board);
          }, 4000);
      });
    });
    
  • sorry i did not respond, i got it working in cpp, i was just missing a pointer reference to the board in one of my functions

  • thanks for the update @DylanMach1

Sign In or Register to comment.