Skip to content

Commit 5e4c6b6

Browse files
author
Marcus Sonestedt
committed
ServoPID: Fix PCA9685 typos
1 parent 46a4cf8 commit 5e4c6b6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ServoPID/servopid.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ class PCA9685Servo : public ServoBase
103103
public:
104104
PCA9685Servo() = default;
105105

106-
void attach(int pin, int pwmMin, int pwmMax)
106+
void attach(const int pin, const int pwmMin, const int pwmMax)
107107
{
108108
_pin = pin;
109109
_servoEval = PCA9685_ServoEvaluator(pwmMin, pwmMax);
110110
}
111111

112112
// ReSharper disable once CppMemberFunctionMayBeConst
113-
void write(float angle)
113+
void write(const float angle)
114114
{
115115
const auto cAngle = constrain(angle, float(MinAngle), float(MaxAngle));
116116
const auto pwm = _servoEval.pwmForAngle(cAngle);
@@ -158,7 +158,7 @@ public:
158158
_servo.write(_output * 180.0f);
159159
}
160160

161-
#if USE_PCA9684 == 1
161+
#if USE_PCA9685 == 1
162162
PCA9685Servo _servo;
163163
#else
164164
ArduinoServo _servo;
@@ -193,10 +193,10 @@ void setup()
193193
Wire.begin(); // Wire must be started first
194194
Wire.setClock(400000); // Supported baud rates are 100kHz, 400kHz, and 1000kHz
195195

196-
pwmController.resetDevices(); // Software resets all PCA9685 devices on Wire line
196+
gPwmController.resetDevices(); // Software resets all PCA9685 devices on Wire line
197197

198-
pwmController.init(B010101); // Address pins A5-A0 set to B010101
199-
pwmController.setPWMFrequency(500); // Default is 200Hz, supports 24Hz to 1526Hz
198+
gPwmController.init(21); // Address pins A5-A0 set to B010101
199+
gPwmController.setPWMFrequency(500); // Default is 200Hz, supports 24Hz to 1526Hz
200200
#endif
201201

202202
// assume servos on pin 3,5,6,9 and potentiometers on analog in 0,1,2,3

0 commit comments

Comments
 (0)