23 lines
535 B
C++
23 lines
535 B
C++
#include <I2CMotor.h>
|
|
|
|
I2CMotor motor;
|
|
|
|
void setup() {
|
|
Serial.begin(115200);
|
|
motor.begin();
|
|
|
|
if (motor.found()) {
|
|
Serial.print("Motor controller found at address 0x");
|
|
Serial.println(motor.address(), HEX);
|
|
Serial.println("Identification: " + motor.identify());
|
|
motor.setMotorDirection(1, 1); // Motor 1 forward
|
|
motor.setMotorSpeed(1, 50); // 50% speed
|
|
} else {
|
|
Serial.println("Motor controller not found!");
|
|
}
|
|
}
|
|
|
|
void loop() {
|
|
// Add your control logic here
|
|
}
|