The on-board flash memory can also be used to store MetaWear commands instead of sensor data. Recorded commands can be executed any time after being programmed with the IMacro module.

using MbientLab.MetaWear.Core;

IMacro macro = metawear.GetModule<IMacro>();

Recording Commands

To record commands:

  1. Call StartRecord to put the API in macro mode
  2. Use the MetaWear commands that you want programmed
  3. Exit macro mode with EndRecordAsync

By default, macros will be executed on boot. Call StartRecord with false to disable this behavior.

using MbientLab.MetaWear.Peripheral

ILed led = metawear.GetModule<ILed>();

var id = await macro.EndRecord();

Console.WriteLine("Macro ID = " + id);

Erasing Macros

Erasing macros is done with the EraseAll method. The erase operation will not occur until you disconnect from the board.