mirror of
https://github.com/LinoSchmidt/RoboterArm.git
synced 2026-03-21 02:31:16 +01:00
Added auto Recalibration
This commit is contained in:
@@ -261,7 +261,10 @@ void joystickButtonPress(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Autoplay(){
|
void Autoplay(){
|
||||||
if(autoplayLoop+1 >= sizeof(autoplayPos)/sizeof(autoplayPos[0])) autoplayLoop = 0;
|
if(autoplayLoop+1 >= sizeof(autoplayPos)/sizeof(autoplayPos[0])) {
|
||||||
|
autoplayLoop = 0;
|
||||||
|
calibrateMiddle();
|
||||||
|
}
|
||||||
|
|
||||||
if(autoplayStart) {
|
if(autoplayStart) {
|
||||||
autoplayStart = false;
|
autoplayStart = false;
|
||||||
@@ -308,8 +311,14 @@ void loop(){
|
|||||||
|
|
||||||
if(joystick_LX == 0 && joystick_LY == 0 && joystick_RX == 0 && joystick_RY == 0){
|
if(joystick_LX == 0 && joystick_LY == 0 && joystick_RX == 0 && joystick_RY == 0){
|
||||||
noTone(BuzzerPin);
|
noTone(BuzzerPin);
|
||||||
if (TimeToAutoplay > offtime)
|
|
||||||
offtime++;
|
if (TimeToAutoplay > offtime) offtime++;
|
||||||
|
|
||||||
|
if(offtime >= TimeToAutoplay) {
|
||||||
|
Autoplay();
|
||||||
|
} else if(offtime == TimeToDetach){
|
||||||
|
detachAttach(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
offtime = 0;
|
offtime = 0;
|
||||||
@@ -365,13 +374,6 @@ void loop(){
|
|||||||
servoWrite();
|
servoWrite();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(offtime >= TimeToAutoplay){
|
|
||||||
Autoplay();
|
|
||||||
}
|
|
||||||
else if(offtime >= TimeToDetach){
|
|
||||||
detachAttach(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(digitalRead(joystick_button_Pin) == LOW){
|
if(digitalRead(joystick_button_Pin) == LOW){
|
||||||
detachAttach(true);
|
detachAttach(true);
|
||||||
joystickButtonPress();
|
joystickButtonPress();
|
||||||
|
|||||||
Reference in New Issue
Block a user