just want to figure out why its not right cheers.
/////////////////motors/////
int A = 8;
int B = 9;
int C = 10;
int D = 11;
/////////////////delays/////
int T = 5;
int H = 4;
int DS = 1;
int DP = 2;
////////////////steprate///////
int Wstep = 510;
int Fstep = 510;
int Dstep = 510;
int DPstep = 510;
////////////////rotation////////
int Rot = 0;
/////////////////pause//////////
int Pause = 250;
/////////////////////////////
void setup() {
// put your setup code here, to run once:
pinMode(A, OUTPUT);
pinMode(B, OUTPUT);
pinMode(C, OUTPUT);
pinMode(D, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if (Serial.available())
{
Rot = Serial.parseInt();
int CMD = Serial.parseInt();
for (int i = 0; i < Rot; ++) {
switch (CMD) {
case 1: Wavedrive(); break;
case 2: Fulldrive(); break:
case 3: Doublestep(); break:
case 4: Dualphase(); break:
}
}
}
}
void WaveD = drive() {
for (int 1 = 0; 1 < Wstep; i++) {
digitalWrite(A, 1); digitalWrite(D, 0);
delay (T);
digitalWrite(B, 1); digitalWrite(A, 0);
delay (T);
digitalWrite(C, 1); digitalWrite(B, 0);
delay(T);
digitalWrite(D, 1); digitalWrite(C, 0);
delay (T);
}
digitalWrite(D, 0);
delay (Pause);
}
void Fullstep() {
for (inti = 0; i < Fstep; i++) {
digitalWrite(A, 1); digitalWrite(C, 0);
delay(T);
digitalWrite(B, 1); digitalWrite(D, 0);
delay(T);
digitalWrite(C, 1); digitalWrite(A, 0);
delay(T);
digitalWrite(D, 1); digitalWrite(B, 0);
delay(T);
}
digitalWrite(C, 0);
digitalWrite(D, 0);
delay(Pause);
}
void Doublestep() {
for (int i = 0; i < Dstep; i++) {
digitalWrite(A, 1);
delay(DS);
digitalWrite(B, 1);
delay(DS);
digitalWrite(A, 0);
delay(DS);
digitalWrite(C, 1);
delay(DS);
digitalWrite(B, 0);
delay(DS);
digitalWrite(D, 1);
delay(DS);
digitalWrite(C, 0;
delay(DS);
digitalWrite(A, 1);
delay(DS);
digitalWrite(D, 0);
}
digitalWrite(A, 0);
delay(pause);
void Dualphase() {
for (int i = 0 < DPstep; i++) {
digitalWrite(D, 0);
digitalWrite(A, 1);
digitalWrite(B, 1);
delay(DP);
digitalWrite(A, 0);
digitalWrite(B, 1);
digitalWrite(C, 1);
delay(DP);
digitalWrite(B, 0);
digitalWrite(C, 1);
digitalWrite(D, 1);
delay(DP);
digitalWrite(C, 0);
digitalWrite(D, 1);
digitalWrite(A, 1);
delay(DP);
}
digitalWrite(A, 0);
digitalWrite(D, 0);
delay(pause);
}