Advanced Topic Skip if you’re new, explore when you’re ready.
When you want to add support for a motor type that isn’t supported out of the box with Bottango, Custom Motors are a great tool. They act a lot like a union of built-in supported effectors and custom events. You can combine the callbacks from effector lifecycle to manage enabling, disabling, and driving the motor. Bottango will call the callbacks at the right time for each, and animate the signal value of the motor, but it’s up to you to provide your own logic on how to drive your motor based on the events.
void onEffectorRegistered(AbstractEffector *effector){ char effectorIdentifier[9]; effector->getIdentifier(effectorIdentifier, 9);
if (strcmp(effectorIdentifier, "myMotor") == 0) { // Enable the motor here }}void onEffectorDeregistered(AbstractEffector *effector){ char effectorIdentifier[9]; effector->getIdentifier(effectorIdentifier, 9);
if (strcmp(effectorIdentifier, "myMotor") == 0) { // Disable the motor here }}void effectorSignalOnLoop(AbstractEffector *effector, int signal, bool didChange){ char effectorIdentifier[9]; effector->getIdentifier(effectorIdentifier, 9);
if (strcmp(effectorIdentifier, "myMotor") == 0) { // Drive the motor to the animated position here using int signal and bool didChange }}