Logging functions in the logging.h header file control the on-board logger.

These functions go hand in hand with the data signal logger outlined in the Data Signal section.

Once a logger is created; logging functions can be used. After you have setup the signal loggers, start the logger by calling mbl_mw_logging_start.

signal = libmetawear.mbl_mw_acc_get_acceleration_data_signal(board)
logger = create_voidp(lambda fn: libmetawear.mbl_mw_datasignal_log(signal, None, fn), resource = "acc_logger")

libmetawear.mbl_mw_logging_start(board, 0)

Once we are done logging, simply call:


Note for the MMS

The MMS (MetaMotionS) board uses NAND flash memory to store data on the device itself. The NAND memory stores data in pages that are 512 entries large. When data is retrieved, it is retrieved in page sized chunks.

Before doing a full download of the log memory on the MMS, the final set of data needs to be written to the NAND flash before it can be downloaded as a page. To do this, you must call the function:


This should not be called if you are still logging data.

Downloading Data

When you are ready to retrieve the data, execute mbl_mw_logging_download.

You will need to pass in a MblMwLogDownloadHandler struct to handle notifications from the logger.

e = Event()

def progress_update_handler(context, entries_left, total_entries):
    if (entries_left == 0):

fn_wrapper = FnVoid_VoidP_UInt_UInt(progress_update_handler)

download_handler = LogDownloadHandler(context = None, \
    received_progress_update = fn_wrapper, \
    received_unknown_entry = cast(None, FnVoid_VoidP_UByte_Long_UByteP_UByte), \
    received_unhandled_entry = cast(None, FnVoid_VoidP_DataP))

callback = FnVoid_VoidP_DataP(lambda ctx, p: print("{epoch: %d, value: %s}" % (p.contents.epoch, parse_value(p))))

libmetawear.mbl_mw_logger_subscribe(logger, None, callback)
libmetawear.mbl_mw_logging_download(d.board, 0, byref(download_handler))