The adafruit motor shield library won't compile for esp32 and i only want to control to motors, out of 4 ports, the library example it self reurns an erorr, /storage/emulated/0/ArduinoDroid/userlibraries/Adafruit_Motor_Shield_library/AFMotor.h:156:47: error: 'DC_MOTOR_PWM_RATE' was not declared in this scope
I also dont understand why many other pins like en , and ? ? Latch are used, still will wire it tho
Me too.
Post your current sketch to see how we can help.
If you had bothered to read the how to get the best from the forum post you would know that we can give best help if you properly post well formatted code, a schematic, links to any libraries that don't come with the IDE.
// Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!
#include <AFMotor.h>
AF_DCMotor motor(4);
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Motor test!");
// turn on motor
motor.setSpeed(200);
motor.run(RELEASE);
}
void loop() {
uint8_t i;
Serial.print("tick");
motor.run(FORWARD);
for (i=0; i<255; i++) {
motor.setSpeed(i);
delay(10);
}
for (i=255; i!=0; i--) {
motor.setSpeed(i);
delay(10);
}
Serial.print("tock");
motor.run(BACKWARD);
for (i=0; i<255; i++) {
motor.setSpeed(i);
delay(10);
}
for (i=255; i!=0; i--) {
motor.setSpeed(i);
delay(10);
}
Serial.print("tech");
motor.run(RELEASE);
delay(1000);
}
This is the adafruit library example, i have tested it with an arduino and compiled successfully and worked
This Motor Driver Board is specifically designed for arduino UNO and it just goes over the UNO Board.
For ESP32 Board, you may use the L298 Motor Driver Board and write the codes to control the Motors based on te following truth Table:
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.