Hi,
I ve this code with a movements for a scanner 3d with a LIDAR. My problem is that i need to know the degrees of the movements in every moment, for mix it with the LIDAR measures. How can i get these variables?
#include <Stepper.h>
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution for the motor
int contador=0;
float alpha=0;
float alpha2=0;
const float pi = 3.141593;
int f=0;Stepper myStepperZ(stepsPerRevolution, 8, 9, 10, 11); // initialize the stepper library on pins 8 through 11:
Stepper myStepperY(stepsPerRevolution, 3, 4, 5, 6);void setup() {
myStepperZ.setSpeed(20); // set the speed at 20 rpm:
myStepperY.setSpeed(5); // set the speed at 5 rpm:
Serial.begin(9600); // initialize the serial port:
}void loop() {
delay(6000); //delay de un minuto antes de empezar
while(contador<25){ //25repeticiones
myStepperZ.step(200);// step one revolution in one direction (sentido horario):
delay(500);
myStepperY.step(1);
delay(500);
myStepperZ.step(-200);// step one revolution in the other direction (sentido antihorario):
delay(500);
myStepperY.step(1);
delay(500);
contador++;
}
}