Ciao a tutti
Mi stavo studiando un articolo su Instructables sui motori stepper e driver DRV8825 Link
Ho scaricato gli esempi da Github Stepper driver
Questo è il codice di un esempio:
#include <Arduino.h>
#include "BasicStepperDriver.h"
// Motor steps per revolution. Most steppers are 200 steps or 1.8 degrees/step
#define MOTOR_STEPS 200
#define RPM 120
// Since microstepping is set externally, make sure this matches the selected mode
// If it doesn't, the motor will move at a different RPM than chosen
// 1=full step, 2=half step etc.
#define MICROSTEPS 1
// All the wires needed for full functionality
#define DIR 8
#define STEP 9
//Uncomment line to use enable/disable functionality
//#define ENABLE 13
// 2-wire basic config, microstepping is hardwired on the driver
BasicStepperDriver stepper(MOTOR_STEPS, DIR, STEP);
//Uncomment line to use enable/disable functionality
//BasicStepperDriver stepper(MOTOR_STEPS, DIR, STEP, ENABLE);
void setup() {
stepper.begin(RPM, MICROSTEPS);
}
void loop() {
// energize coils - the motor will hold position
// stepper.enable();
/*
* Moving motor one full revolution using the degree notation
*/
stepper.rotate(360);
/*
* Moving motor to original position using steps
*/
stepper.move(-MOTOR_STEPS*MICROSTEPS);
// pause and allow the motor to be moved by hand
// stepper.disable();
delay(5000);
}
In compilazione mi da questo errore che non riesco a interpretare:
Arduino:1.6.11 (Windows XP), Scheda:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
D:\DOCUME~1\Franco\IMPOST~1\Temp\ccFDKBcY.ltrans0.ltrans.o: In function `main':
ccFDKBcY.ltrans0.o:(.text.startup+0xec): undefined reference to `BasicStepperDriver::begin(short, short)'
ccFDKBcY.ltrans0.o:(.text.startup+0x100): undefined reference to `BasicStepperDriver::rotate(long)'
ccFDKBcY.ltrans0.o:(.text.startup+0x110): undefined reference to `BasicStepperDriver::move(long)'
D:\DOCUME~1\Franco\IMPOST~1\Temp\ccFDKBcY.ltrans0.ltrans.o: In function `_GLOBAL__sub_I_stepper':
ccFDKBcY.ltrans0.o:(.text.startup+0x178): undefined reference to `BasicStepperDriver::BasicStepperDriver(short, short, short)'
collect2.exe: error: ld returned 1 exit status
exit status 1
Errore durante la compilazione per la scheda Arduino/Genuino Mega or Mega 2560.
Questo report potrebbe essere più ricco di informazioni con l'opzione
"Mostra un output dettagliato durante la compilazione"
abilitata in File -> Impostazioni
Mi potete aiutare?
Franco