Update N6JJ_WiFi_Stepper_Motor_Controller.ino
1. Updated the "FineTune" Delays and Rotation to be more accurate 2. Replaced "Steps" with "Delay" - It will be more clear to understand 3. Fix typo in a commentmain
rodzic
9c7f2ad3f4
commit
202bf54623
|
@ -94,15 +94,15 @@ BLYNK_WRITE(V4){ // Blynk virtual pin V4
|
|||
|
||||
// -- Main Tunning Function ---------------------------------------------------------------------------------
|
||||
|
||||
void Tunning (int Steps, int Rotation){
|
||||
void Tunning (int Delay, int Rotation){
|
||||
digitalWrite(enablePin, LOW); // enable the driver
|
||||
for (int i = 0; i < Rotation; i++){ // loop for motor steps
|
||||
digitalWrite(stepPin, HIGH); // perform a step
|
||||
digitalWrite(LED_BUILTIN, LOW); // turn LED indicator OFF
|
||||
delayMicroseconds(Steps); // wait for the steps operation
|
||||
delayMicroseconds(Delay); // wait for the steps operation
|
||||
digitalWrite(stepPin, LOW); // stop the step
|
||||
digitalWrite(LED_BUILTIN, HIGH); // tuen LED indicator ON
|
||||
delayMicroseconds(Steps); // wait between steps
|
||||
digitalWrite(LED_BUILTIN, HIGH); // tune LED indicator ON
|
||||
delayMicroseconds(Delay); // wait between steps
|
||||
Blynk.run();
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ void loop() {
|
|||
|
||||
if (FineTuneRight){ // fine turn right
|
||||
digitalWrite(dirPin, LOW); // set direction to one side
|
||||
Tunning(3000, 16); // turn slow, aka "Fine Tune"
|
||||
Tunning(10000, 1); // turn slow, aka "Fine Tune"
|
||||
}
|
||||
|
||||
if (TuneLeft){ // turn left
|
||||
|
@ -132,7 +132,7 @@ void loop() {
|
|||
|
||||
if (FineTuneLeft){ // fine turn left
|
||||
digitalWrite(dirPin, HIGH); // set direction to the other side
|
||||
Tunning(3000, 16); // turn slow, aka "Fine Tune"
|
||||
Tunning(10000, 1); // turn slow, aka "Fine Tune"
|
||||
}
|
||||
|
||||
while (Scan) { // scan as long as the App button is enable
|
||||
|
|
Ładowanie…
Reference in New Issue