Basic ExampleΒΆ
#include <iostream>
#include "BrainStem2/BrainStem-all.h"
int main(int argc, const char * argv[]) {
//Create an instance of a MTM-PM-1 module.
aMTMPM1 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();
}
import brainstem
#for easy access to error constants
from brainstem.result import Result
import time
import sys
# Create an instance of a MTM-PM-1 module.
mtm = brainstem.stem.MTMPM1();
# Locate and connect to the first object you find on MTM
result = hub.mtm.discoverAndConnect(linkType, serialNumber, modelNumber)
if result != Result.NO_ERROR:
print ("Error %d encountered connecting to BrainStem Module.\n" % result)
else:
print ("Connected to BrainStem module.\n")
#Basic initialization (Get everything turned off).
mtm.system.setLED(0)
##Ready for testing
##Enable LED
mtm.system.setLED(1)
##Finished with testing.
##Turn off LED
mtm.system.setLED(0)
# Disconnect from device.
mtm.disconnect();
print("Disconnected from BrainStem module. \n")