Skip to content

Commit

Permalink
Corrected code
Browse files Browse the repository at this point in the history
there was some copy-paste error
  • Loading branch information
LoBrol committed Oct 31, 2022
1 parent dc53848 commit 884eed7
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions LinoRoboArm.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,26 @@ class LinoRoboArm {



/**
* @brief LinoRoboArm constructor, initialize Adafruit_PWMServoDriver library
* @return null
*/
LinoRoboArm::LinoRoboArm() {
pwm = Adafruit_PWMServoDriver();
pwm.begin();
pwm.setOscillatorFrequency(27000000);
pwm.setPWMFreq(SERVO_FREQ);
pwm.setPWMFreq(50);
}





/**
* @brief LinoRoboArm constructor, initialize Adafruit_PWMServoDriver library
* @param newPositions[] starting position for all the servos
* @return null
*/
LinoRoboArm::LinoRoboArm(uint16_t newPositions[]) {
pwm = Adafruit_PWMServoDriver();
pwm.begin();
Expand Down Expand Up @@ -95,10 +104,10 @@ void LinoRoboArm::setServos(uint16_t newPositions[6]) {
* @param newPos Servo new position.
* @return acceptable position.
*/
uint16_t LinoRoboArm::checkPos(uint8_t servoID, uint16_t newPos) {
if (pos < minPos[servo]) return minPos[servo];
if (pos > maxPos[servo]) return maxPos[servo];
return pos;
uint16_t LinoRoboArm::checkValidPos(uint8_t servoID, uint16_t newPos) {
if (newPos < minPos[servoID]) newPos = minPos[servo];
if (newPos > maxPos[servoID]) newPos = maxPos[servo];
return newPos;
}


Expand Down Expand Up @@ -141,4 +150,4 @@ void LinoRoboArm::printPositions() {
Serial.print(",");
}
Serial.print(curPos[5]);
}
}

0 comments on commit 884eed7

Please sign in to comment.