Basic ExampleΒΆ

#include <iostream>
#include "BrainStem2/BrainStem-all.h"

int main(int argc, const char * argv[]) {

    //Create an instance of a MTM-USBSTEM module.
    aMTMUSBStem mtm;

    //Connect to the hardware.
    err = mtm.discoverAndConnect(linkType, serialNumber, modelNumber)
    if (err != aErrNone) {
        printf("Error %d encountered connecting to BrainStem module\n", err);
       return 1;

    } else { printf("Connected to BrainStem module.\n"); }

    //Basic initialization (Get LEDs turned off).
    mtm.system.setLED(0);

    //Ready for testing
    //Enable LED
    mtm.system.setLED(1);

    //Turn LED off
    mtm.system.setLED(0);

    //Disconnect
    mtm.disconnect();
}