Effector Identifier
Every motor or effector registered has a unique eight character c-string identifier. In the Bottango application, click on a motor to see its identifier. For default motors, the identifier is generated automatically from the pins used to control it, in combination with an i2c address if it exists. For custom motors and events, you define that identifier yourself as a custom string.

Checking Identifier In a Callback
Section titled “Checking Identifier In a Callback”Each callback method dealing with a motor or effector in the “BottangoArduinoCallbacks.cpp” file has a pointer to an AbstractEffector *effector passed as one of the parameters to the callback. In order to determine which effector is being acted on in a particular call to a callback, you can access the identifier of the effector, and compare it against a desired identifier.
As an example, let’s say you wanted to know if the call to a callback when a motor is registered (turned live) was happening on a motor with the identifier “6” and you wanted to do some additional logic of your own.
void onEffectorRegistered(AbstractEffector *effector){ char effectorIdentifier[9]; // initialize a c-string to hold the identifier effector->getIdentifier(effectorIdentifier, 9); // fill the c-string with the identifier from the passed effector
if (strcmp(effectorIdentifier, "6") == 0) // strcmp(char* str1, char* str2) lets us know if the strings match { // my logic here }}Getting Effector By Identifier
Section titled “Getting Effector By Identifier”It’s also possible to go the other way, and get an effector by passing an identifier to the effector pool that is owned by BottangoCore.
void onEarlyLoop(){ if (digitalRead(8) == LOW) { char desiredID[] = "6"; AbstractEffector *foundEffector = BottangoCore::effectorPool.getEffector(desiredID); if (foundEffector != nullptr) { foundEffector->resetHome(); } }}Here you can see that on each loop tick, we check if pin 8 is read LOW (for example, maybe a limit switch). Then we get the effector with the identifier “6” and reset its homing state back to unhomed.