Hi there,
So that is for a samd21 or seeduino, compiles fine.
I would try this one, and it compiles for ESP32C3 aok.
it’s for an 8835 motor which is newer. But will still work.
#include <DRV8835MotorShield.h>
/*
* This example uses the DRV8835MotorShield library to drive each motor with the
* Pololu DRV8835 Dual Motor Driver Shield for Arduino forward, then backward.
* The yellow user LED is on when a motor is set to a positive speed and off when
* a motor is set to a negative speed.
*/
#define LED_PIN 13
DRV8835MotorShield motors;
void setup()
{
pinMode(LED_PIN, OUTPUT);
// uncomment one or both of the following lines if your motors' directions need to be flipped
//motors.flipM1(true);
//motors.flipM2(true);
}
void loop()
{
// run M1 motor with positive speed
digitalWrite(LED_PIN, HIGH);
for (int speed = 0; speed <= 400; speed++)
{
motors.setM1Speed(speed);
delay(2);
}
for (int speed = 400; speed >= 0; speed--)
{
motors.setM1Speed(speed);
delay(2);
}
// run M1 motor with negative speed
digitalWrite(LED_PIN, LOW);
for (int speed = 0; speed >= -400; speed--)
{
motors.setM1Speed(speed);
delay(2);
}
for (int speed = -400; speed <= 0; speed++)
{
motors.setM1Speed(speed);
delay(2);
}
// run M2 motor with positive speed
digitalWrite(LED_PIN, HIGH);
for (int speed = 0; speed <= 400; speed++)
{
motors.setM2Speed(speed);
delay(2);
}
for (int speed = 400; speed >= 0; speed--)
{
motors.setM2Speed(speed);
delay(2);
}
// run M2 motor with negative speed
digitalWrite(LED_PIN, LOW);
for (int speed = 0; speed >= -400; speed--)
{
motors.setM2Speed(speed);
delay(2);
}
for (int speed = -400; speed <= 0; speed++)
{
motors.setM2Speed(speed);
delay(2);
}
delay(500);
}
add the lib and it rolls right along, HTH
GL PJ
here is the link , these POLOlu guys have cornered the market on this stuff. Check it out.