Initial test output and time management.
This commit is contained in:
parent
4da6c7cc79
commit
337517c7f8
1 changed files with 17 additions and 1 deletions
18
Lanes.ino
18
Lanes.ino
|
@ -23,6 +23,8 @@ bool ClockState = false;
|
||||||
int PpQN = 24;
|
int PpQN = 24;
|
||||||
float Clock = 120;
|
float Clock = 120;
|
||||||
float ClockTick = 1/((Clock * PpQN)/60);
|
float ClockTick = 1/((Clock * PpQN)/60);
|
||||||
|
unsigned long ClockTime = 0;
|
||||||
|
unsigned long LastStepTime = 0;
|
||||||
long Lane1Pos, Lane2Pos, Lane3Pos, Lane1Time, Lane2Time, Lane3Time = 0;
|
long Lane1Pos, Lane2Pos, Lane3Pos, Lane1Time, Lane2Time, Lane3Time = 0;
|
||||||
|
|
||||||
//Lanes are 4 dimentions 0 = Step Time, 1 = Step Voltage, 2 = Curve type (Linear, Expo, Log, Sine, etc) 3 = Curve Parameter.
|
//Lanes are 4 dimentions 0 = Step Time, 1 = Step Voltage, 2 = Curve type (Linear, Expo, Log, Sine, etc) 3 = Curve Parameter.
|
||||||
|
@ -47,11 +49,25 @@ void setup() {
|
||||||
Lane2[j][i] = Lane3[i][j] = 0;
|
Lane2[j][i] = Lane3[i][j] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
analogWrite( Lane1Pin, Lane1[1][0]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
||||||
delay(1);
|
delay(1);
|
||||||
|
|
||||||
|
|
||||||
|
unsigned long currentTime = millis();
|
||||||
|
|
||||||
|
if ((currentTime - LastStepTime) > ClockTick){
|
||||||
|
ClockTime++;
|
||||||
|
LastStepTime = currentTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((ClockTime - Lane1Time) > Lane1[0][Lane1Pos]){
|
||||||
|
Lane1Pos = (Lane1Pos + 1) & B00001111;
|
||||||
|
Lane1Time = ClockTime;
|
||||||
|
analogWrite(Lane1Pin, Lane1[1][Lane1Pos]);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue