update c mac steppers to take args and remove windows.h
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
// Leib Ramp Stepper program with millis function adapted for MacOS
|
// Leib Ramp Stepper program with millis function adapted for MacOS
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <windows.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
@@ -52,16 +51,12 @@ const float minSpeed = 1.0;
|
|||||||
const float maxPermissSpeed = 20.0;
|
const float maxPermissSpeed = 20.0;
|
||||||
const float maxAccel = 10.0;
|
const float maxAccel = 10.0;
|
||||||
|
|
||||||
int main()
|
int main(int argc, char *argv[1])
|
||||||
{
|
{
|
||||||
unsigned long currentMillis = millis();
|
unsigned long currentMillis = millis();
|
||||||
prevStepTime = 0;
|
prevStepTime = 0;
|
||||||
long positionToMoveTo;
|
long positionToMoveTo;
|
||||||
while(true)
|
sscanf(argv[1], "%ld", &positionToMoveTo);
|
||||||
{
|
|
||||||
printf("Enter position to move to in profile (or 999 to terminate)\n");
|
|
||||||
scanf("%ld", &positionToMoveTo);
|
|
||||||
if (positionToMoveTo==999) break;
|
|
||||||
printf(" Time (s), Speed (steps/s), Accel (steps/s^2), Posit'n (steps), Step time (ticks)\n");
|
printf(" Time (s), Speed (steps/s), Accel (steps/s^2), Posit'n (steps), Step time (ticks)\n");
|
||||||
|
|
||||||
goToPosition(positionToMoveTo);
|
goToPosition(positionToMoveTo);
|
||||||
@@ -104,7 +99,6 @@ int main()
|
|||||||
computeNewSpeed();
|
computeNewSpeed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <windows.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
@@ -48,16 +47,12 @@ const float minSpeed = 1.0; // in steps/s
|
|||||||
const float maxPermissSpeed = 20.0; // in steps/s
|
const float maxPermissSpeed = 20.0; // in steps/s
|
||||||
const float maxAccel = 10.0; // in steps/s^2
|
const float maxAccel = 10.0; // in steps/s^2
|
||||||
|
|
||||||
int main()
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
unsigned long currentMillis = millis();
|
unsigned long currentMillis = millis();
|
||||||
prevStepTime = 0;
|
prevStepTime = 0;
|
||||||
long positionToMoveTo;
|
long positionToMoveTo;
|
||||||
while(true)
|
sscanf(argv[1], "%ld", &positionToMoveTo);
|
||||||
{
|
|
||||||
printf("Enter position to move to in profile (or 999 to terminate)\n");
|
|
||||||
scanf("%ld", &positionToMoveTo);
|
|
||||||
if (positionToMoveTo==999) break;
|
|
||||||
printf(" Time (s), Speed (steps/s), Accel (steps/s^2), Posit'n (steps), Step time (ticks)\n");
|
printf(" Time (s), Speed (steps/s), Accel (steps/s^2), Posit'n (steps), Step time (ticks)\n");
|
||||||
|
|
||||||
goToPosition(positionToMoveTo);
|
goToPosition(positionToMoveTo);
|
||||||
@@ -93,7 +88,6 @@ int main()
|
|||||||
computeNewSpeed();
|
computeNewSpeed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user