/** * \par Function * runSpeedAndTime * \par Description * The speed and time of Motor's movement. * \param[in] * speed - The speed move of Motor. * \param[in] * time - The time move of Motor. * \param[in] * lock_state - The lock state of Motor. * \par Output * None * \par Return * None * \par Others * None */ void MeEncoderNew::runSpeedAndTime(float speed, float time, float lock_state) { if(_lastTime == 0) { _lastTime = millis(); runSpeed(speed,lock_state); } if(millis() - _lastTime > (1000 * time)) { _lastTime = 0; runSpeed(0,lock_state); } }
void MeEncoderNew::runSpeedAndTime(int speed, float time) { if(_lastTime == 0) { _lastTime = millis(); runSpeed(speed); } if(millis() - _lastTime > time) { _lastTime = 0; runSpeed(0); } }
boolean AccelStepper::runSpeedToPosition() { if (_targetPos >_currentPos) _speed = fabs(_speed); else _speed = -fabs(_speed); return _targetPos!=_currentPos ? runSpeed() : false; }
boolean MeStepper::run() { if (_targetPos == _currentPos) return false; if (runSpeed()) computeNewSpeed(); return true; }
boolean AccelStepper::runSpeedToPosition() { if (_targetPos == _currentPos) return false; if (_targetPos >_currentPos) _direction = DIRECTION_CW; else _direction = DIRECTION_CCW; return runSpeed(); }
uint8_t runSpeedToPosition(Stepper_t* motor) { if (motor->_targetPos == motor->_currentPos) return 0; // false if (motor->_targetPos > motor->_currentPos) motor->_direction = DIRECTION_CW; else motor->_direction = DIRECTION_CCW; return runSpeed(motor); }
/** * \par Function * run * \par Description * Stepper's status----run or not. * \param[in] * None * \par Output * None * \par Return * Return the status. * \par Others * None */ boolean MeStepper::run() { if((_speed == 0.0) || (distanceToGo() == 0)) { return false; } if (runSpeed()) { computeNewSpeed(); return true; } }
/** * \par Function * runSpeedToPosition * \par Description * The speed of Stepper on the way to position. * \param[in] * None * \par Output * None * \par Return * Return true or false. * \par Others * None */ boolean MeStepper::runSpeedToPosition() { if (_targetPos == _currentPos) { return false; } if (_targetPos >_currentPos) { _dir = DIRECTION_CW; } else { _dir = DIRECTION_CCW; } return runSpeed(); }
/** * \par Function * update * \par Description * The Stepper loop function, used to move the stepper. * \param[in] * None * \par Output * None * \par Return * None * \par Others * None */ void MeStepperOnBoard::update(void) { if(_mode == 0) { runSpeed(); } else { long dist = distanceToGo(); if(dist==0) { if(_moving) { _moving = false; _callback(_slot, _extId); } } runSpeedToPosition(); } }
// Run the motor to implement speed and acceleration in order to proceed to the target position // You must call this at least once per step, preferably in your main loop // If the motor is in the desired position, the cost is very small // returns true if the motor is still running to the target position. boolean AccelStepper::run() { if (runSpeed()) computeNewSpeed(); return _speed != 0.0 || distanceToGo() != 0; }
// Run the motor to implement speed and acceleration in order to proceed to the target position // You must call this at least once per step, preferably in your main loop // If the motor is in the desired position, the cost is very small // returns true if the motor is still running to the target position. uint8_t run(Stepper_t* motor) { if (runSpeed(motor)) computeNewSpeed(motor); return motor->_speed != 0.0 || distanceToGo(motor) != 0; }
// Run the motor to implement speed and acceleration in order to proceed to the target position // You must call this at least once per step, preferably in your main loop // If the motor is in the desired position, the cost is very small // returns true if we are still running to position bool AccelStepper::run() { if (runSpeed()) computeNewSpeed(); return true; }
boolean AccelStepper::runSpeedToPosition() { return _targetPos!=_currentPos ? runSpeed() : false; }
// Run the motor to implement speed and acceleration in order to proceed to the target position // You must call this at least once per step, preferably in your main loop // If the motor is in the desired position, the cost is very small // returns true if the motor is still running to the target position. boolean AccelStepper::run() { if (runSpeed()) computeNewSpeed(); return ((_speed != 0.0) || (distanceToGo() != 0)); }