Hi
I am doing code for an 360 product camera using 2 different steppers. ive worked out most of the general movment and in the process of adding customisation. the problem is when i am trying to get the second stepper to rotate a certain amount in a void function the other stepper ( Which is meant to be constantly moving until said otherwise) stops for the duration of this void. I have tried putting a stepper.runspeed inside the void but nothing seems to work, can anyone offer any advice?
#include <AccelStepper.h>
#include <LiquidCrystal.h>
#include <Stepper.h>
#include "IRremote.h"
//
int receiver = 12;
int Count = 0;
int CountAng = 0;
int Rotation = 0;
int Angle;
int Home = 1;
IRrecv irrecv(receiver);
decode_results results;
AccelStepper stepper (4,8,9,10,11);
Stepper stepper2 (2048,3,4,5,6);
//LiquidCrystal lcd(A5, A4, A3, A2, A1, A0);//
int Speed = 100;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
stepper.setMaxSpeed(475);
stepper.setSpeed(Speed);
//lcd.begin(16, 2);
stepper2.setSpeed(17); //RPM
}
void loop()
{
//stepper2.runSpeed();
if (irrecv.decode(&results))
{
switch(results.value)
{
case 0xFF02FD: //Play
Count = (1);
break;
case 0xFF629D: //Vol+
Speed = Speed+10;
Serial.println(Speed);
stepper.setSpeed(Speed);
break;
case 0xFFA857: //Vol-
Speed = Speed-10;
Serial.println(Speed);
stepper.setSpeed(Speed);
break;
case 0xFFE21D: //Stop
Count = 0;
Speed = 100;
stepper.setSpeed(Speed);
break;
case 0xFFC23D: //FAST FORWARD
//RotationStart();
break;
case 0xFF6897: //0
break;
case 0xFF30CF: //1
Serial.println("Bang");
Angle = 90;
stepper.runSpeed();
SetAngle();
break;
case 0xFF18E7: //2
break;
case 0xFF7A85: //3
break;
}
irrecv.resume(); // receive the next value
}
if (Count ==1){
stepper.runSpeed();
}
else{
//digitalWrite(8, LOW);
//digitalWrite(9, LOW);
//digitalWrite(10, LOW);
//digitalWrite(11, LOW);
}
/*lcd.begin(16, 2);
lcd.print("RPM: ");
lcd.print(Speed);
*/
}/* --end main loop -- */
void SetAngle(){
Angle = map(Angle,0,90,0,8192);
stepper2.step(Angle);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
}