-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cbbeee3
commit 6fe295c
Showing
1 changed file
with
45 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
#ifndef Step_er | ||
#define Step_er | ||
|
||
#include "arduino.h" | ||
|
||
#define WAVE_DRIVE 0 | ||
#define FULL_STEP 1 | ||
#define HALF_STEP 2 | ||
|
||
class Step_er { | ||
public: | ||
|
||
Step_er(int mode); | ||
void attach(int IN1, int IN2, int IN3, int IN4); | ||
void release(); | ||
void resetTo(int btn, boolean dir=true); | ||
void step_move(int steps, boolean dir=true); | ||
void ang_move(float ang, boolean dir=true); | ||
void turn(int turns, boolean dir=true); | ||
void one(boolean dir=true); | ||
|
||
private: | ||
|
||
void SetDirection(); | ||
void Stepping(int xw); | ||
|
||
float ang_to_step(float ang); | ||
|
||
int _IN1, _IN2, _IN3, _IN4; | ||
int _mode; | ||
int _Smax; | ||
int _curStep = 0; | ||
int _step, _stepLeft; | ||
int _vel; | ||
int _turns; | ||
int _modes[3][8][4] = { | ||
{{LOW, LOW, LOW, HIGH},{LOW, LOW, HIGH,LOW},{LOW, HIGH, LOW, LOW},{HIGH, LOW, LOW, LOW},{LOW, LOW, LOW, HIGH},{LOW, LOW, HIGH,LOW},{LOW, HIGH, LOW, LOW},{HIGH, LOW, LOW, LOW}}, | ||
{{LOW, LOW, HIGH, HIGH},{LOW, HIGH, HIGH, LOW},{HIGH, HIGH, LOW, LOW},{HIGH, LOW, LOW, HIGH},{LOW, LOW, HIGH, HIGH},{LOW, HIGH, HIGH, LOW},{HIGH, HIGH, LOW, LOW},{HIGH, LOW, LOW, HIGH}}, | ||
{{LOW, LOW, LOW, HIGH},{LOW, LOW, HIGH, HIGH},{LOW, LOW, HIGH, LOW},{LOW, HIGH, HIGH, LOW},{LOW, HIGH, LOW, LOW},{HIGH, HIGH, LOW, LOW},{HIGH, LOW, LOW, LOW},{HIGH, LOW, LOW, HIGH}} | ||
}; | ||
boolean _dir; | ||
unsigned long _ltime = 0; | ||
unsigned long _curMils; | ||
}; | ||
|
||
#ifndef St | ||
#define St | ||
|
||
#include "arduino.h" | ||
|
||
#define WAVE_DRIVE 0 | ||
#define FULL_STEP 1 | ||
#define HALF_STEP 2 | ||
|
||
class Step_er { | ||
public: | ||
|
||
Step_er(int mode); | ||
void attach(int IN1, int IN2, int IN3, int IN4); | ||
void release(); | ||
void resetTo(int btn, boolean dir=true); | ||
void step_move(int steps, boolean dir=true); | ||
void ang_move(float ang, boolean dir=true); | ||
void turn(int turns, boolean dir=true); | ||
void one(boolean dir=true); | ||
|
||
private: | ||
|
||
void SetDirection(); | ||
void Stepping(int xw); | ||
|
||
float ang_to_step(float ang); | ||
|
||
int _IN1, _IN2, _IN3, _IN4; | ||
int _mode; | ||
int _Smax; | ||
int _curStep = 0; | ||
int _step, _stepLeft; | ||
int _vel; | ||
int _turns; | ||
int _modes[3][8][4] = { | ||
{{LOW, LOW, LOW, HIGH},{LOW, LOW, HIGH,LOW},{LOW, HIGH, LOW, LOW},{HIGH, LOW, LOW, LOW},{LOW, LOW, LOW, HIGH},{LOW, LOW, HIGH,LOW},{LOW, HIGH, LOW, LOW},{HIGH, LOW, LOW, LOW}}, | ||
{{LOW, LOW, HIGH, HIGH},{LOW, HIGH, HIGH, LOW},{HIGH, HIGH, LOW, LOW},{HIGH, LOW, LOW, HIGH},{LOW, LOW, HIGH, HIGH},{LOW, HIGH, HIGH, LOW},{HIGH, HIGH, LOW, LOW},{HIGH, LOW, LOW, HIGH}}, | ||
{{LOW, LOW, LOW, HIGH},{LOW, LOW, HIGH, HIGH},{LOW, LOW, HIGH, LOW},{LOW, HIGH, HIGH, LOW},{LOW, HIGH, LOW, LOW},{HIGH, HIGH, LOW, LOW},{HIGH, LOW, LOW, LOW},{HIGH, LOW, LOW, HIGH}} | ||
}; | ||
boolean _dir; | ||
unsigned long _ltime = 0; | ||
unsigned long _curMils; | ||
}; | ||
|
||
#endif |