Hello
I am having an issue compiling Mobotools library with an ESP32. I am currently using an Arduino Mega and everything works fine using this library, however I wanted to consider using an ESP32 because it is faster and would enable me to run multiple stepper motors at a high speed and also use multiple timers to avoid code blocking.
I've installed the CP210 VCP_Windows driver, installed espressif board manager, added board manager url (https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json), selected ESP32 dev module in the Arduino IDE boards menu. The board works as I tested it using a buzzer and blink test, however I had to link a 10uf capacitor from EN pin to ground pin to force it into boot mode.
Windows 11
MobaTools library version 2.4.3
Arduino IDE version 1.8.19
Espressif board manager version 2.0.7
CP210 VCP_Windows driver v6.7
Board - AZDelivery ESP32-DevKitC NodeMCU WiFi WLAN CP2102 WROOM-32D
Additionally, if don't comment out MoToTimer pause, it also throws a compilation error saying "'MoToTimer pause' redeclared as different kind of symbol". This compiles and works perfectly fine on an Arduino Mega.
Thanks in advance for any advice.
#include <MobaTools.h>
const byte stepPin = 2;
const byte dirPin = 5;
const int stepsPerRev = 300;
long targetPos = 0;
long nextPos = 300;
MoToStepper myStepper ( stepsPerRev, STEPDIR );
MoToTimer pause;
bool stepperRunning;
int MotorDirection =1;
int StartMotor =0;
int RUNONCE = 0;
String command;
const int enaPin = 51; // 8;
void setup() {
Serial.begin(9600);
// pause.setTime( 100 );
delay(1000);
stepperRunning = false;
Serial.println("ready to go!!!!");
myStepper.attach( stepPin, dirPin );
myStepper.setSpeed( 2500 );
pinMode(enaPin, OUTPUT);
digitalWrite(enaPin, HIGH);
}
void loop() {
if (Serial.available()){
if (RUNONCE == 0){
RUNONCE = 1;
digitalWrite(enaPin, LOW);
}
command = Serial.readStringUntil('\n');
command.trim();
if (command.equals("1"))
{
Serial.println("command 1 forward");
motor_cw() ;
stepperRunning = true;
}
else if (command.equals("2")){
Serial.println("command 2 backward");
motor_ccw() ;
stepperRunning = true;
}
else if (command.equals("d")){
myStepper.stop( );
}
}
}
void motor_cw() {
Serial.println("clock wise");
Serial.print(targetPos);
targetPos = targetPos - nextPos; //700;
myStepper.moveTo( targetPos );
// MotorDirection =1;
StartMotor =1;
}
void motor_ccw() {
Serial.println("counter clock wise");
Serial.print(targetPos);
targetPos = targetPos + nextPos;
myStepper.moveTo( targetPos );
StartMotor =1;
}
esp mobotools error.txt (692.7 KB)