add comments
This commit is contained in:
parent
3ce29a4e29
commit
6469684b54
2 changed files with 18 additions and 9 deletions
|
@ -30,4 +30,4 @@ build_flags =
|
|||
-D PAN_STEP_PIN=D7
|
||||
-D PAN_DIR_PIN=D4
|
||||
-D ENDSTOP_PAN=D5
|
||||
-D PIN_LIGHT=D6
|
||||
-D PIN_OUTPUT=D6
|
|
@ -48,7 +48,8 @@ bool homedTilt=false;
|
|||
AccelStepper stepperPan(AccelStepper::DRIVER, PAN_STEP_PIN, PAN_DIR_PIN);
|
||||
AccelStepper stepperTilt(AccelStepper::DRIVER, TILT_STEP_PIN, TILT_DIR_PIN);
|
||||
|
||||
|
||||
void setOutput(bool o);
|
||||
bool getOutput();
|
||||
void setEnable(bool t);
|
||||
bool getEnable();
|
||||
void setStepperPreset(Stepperpreset preset,Stepper s);
|
||||
|
@ -60,6 +61,12 @@ void testMovementTilt();
|
|||
bool isEndstopPan();
|
||||
bool isEndstopTilt();
|
||||
|
||||
void setOutput(bool o) {
|
||||
digitalWrite(PIN_OUTPUT, o);
|
||||
}
|
||||
bool getOutput() {
|
||||
return digitalRead(PIN_OUTPUT);
|
||||
}
|
||||
|
||||
void setEnable(bool t){
|
||||
digitalWrite(EN_PIN,!t); //active low
|
||||
|
@ -123,11 +130,11 @@ void setStepperPreset(Stepperpreset preset,Stepper s)
|
|||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
pinMode(EN_PIN,OUTPUT);
|
||||
pinMode(ENDSTOP_TILT,INPUT_PULLUP);
|
||||
pinMode(ENDSTOP_PAN,INPUT_PULLUP);
|
||||
pinMode(PIN_LIGHT, OUTPUT);
|
||||
digitalWrite(PIN_LIGHT, LOW);
|
||||
pinMode(PIN_OUTPUT, OUTPUT);
|
||||
setOutput(false);
|
||||
pinMode(EN_PIN,OUTPUT);
|
||||
setEnable(false);
|
||||
|
||||
|
||||
|
@ -322,9 +329,11 @@ void testMovementPan()
|
|||
last_positionReached=0;
|
||||
|
||||
if (stepperPan.currentPosition()<stepsPerRotationPan-100) {
|
||||
stepperPan.moveTo(stepsPerRotationPan);
|
||||
stepperPan.moveTo(stepsPerRotationPan); //move to home
|
||||
setOutput(false); //test output
|
||||
}else{
|
||||
stepperPan.moveTo(stepsPerRotationPan-random(200,stepsPerRotationPan));
|
||||
stepperPan.moveTo(stepsPerRotationPan-random(200,stepsPerRotationPan)); //move somewhere else
|
||||
setOutput(true); //test output
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -339,9 +348,9 @@ void testMovementTilt()
|
|||
last_positionReached=0;
|
||||
|
||||
if (stepperTilt.currentPosition()<stepsPerRotationTilt-100) {
|
||||
stepperTilt.moveTo(stepsPerRotationTilt);
|
||||
stepperTilt.moveTo(stepsPerRotationTilt); //move to home
|
||||
}else{
|
||||
stepperTilt.moveTo(stepsPerRotationTilt-random(200,stepsPerRotationTilt));
|
||||
stepperTilt.moveTo(stepsPerRotationTilt-random(200,stepsPerRotationTilt)); //move somewhere else
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue