forked from rstanislav/PCA9685-Arduino-Library
-
Notifications
You must be signed in to change notification settings - Fork 1
error : does not name a type (PCA9685) #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LVB1961
wants to merge
58
commits into
vitska:master
Choose a base branch
from
NachtRaveVL:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ew minor bugs. Upping version number.
…ng version number.
Arduino TWI library expects 7 bit addresses. The TWI library wrapped by the Wire library performs the address shift and adds the r/w bit to the address. See here https://github.com/esp8266/Arduino/blob/master/cores/esp8266/core_esp8266_si2c.c#L184 " if(!twi_write_byte(((address << 1) | 0) & 0xFF)) {" and "if(!twi_write_byte(((address << 1) | 1) & 0xFF)) {". Confirmed with three chained PCA9685 boards connected a NodeMCU.
Bugfix I2C address
…ead operation (thanks to @svatoun for the catch!).
I suggest cast retVal to unsigned (or PCA9685_PWM_FULL to signed) to overcome comparison between signed and unsigned integer values.
Compiler error:
```
Compiling .pio/build/leonardo/lib021/PCA9685 16-Channel PWM Driver Module Library_ID2100/PCA9685.cpp.o
In file included from .pio/libdeps/leonardo/PCA9685 16-Channel PWM Driver Module Library_ID2100/PCA9685.h:56:0,
from .pio/libdeps/leonardo/PCA9685 16-Channel PWM Driver Module Library_ID2100/PCA9685.cpp:25:
.pio/libdeps/leonardo/PCA9685 16-Channel PWM Driver Module Library_ID2100/PCA9685.cpp: In member function 'uint16_t PCA9685_ServoEvaluator::pwmForAngle(float)':
~/.platformio/packages/framework-arduino-avr/cores/arduino/Arduino.h:95:58: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
^
.pio/libdeps/leonardo/PCA9685 16-Channel PWM Driver Module Library_ID2100/PCA9685.cpp:833:22: note: in expansion of macro 'constrain'
return (uint16_t)constrain((int)roundf(retVal), 0, PCA9685_PWM_FULL);
```
…(low/high) phase values since I noticed a fork containing such. Added library.json for platformIO.
* - Upping version to 1.2.15 - Modified constructor/initializer pathways - Added convenience constructor/initializer - Expanded initialization mode settings - Removed extraneous 1 on defines - Standardized i2c buffer length determination - Expanded & standardized comments/documentation - Moved Wire begin into library (standardization across libraries) - Reworked examples - Added dyanmic phase balancer - Various other standardizations * Wording * Adding VS code settings, better debug output * Adding another datasheet * Standardizing i2c naming * Correct i2c datatype, adding getI2CSpeed * Wrong identifier * Refined getI2CSpeed to deal with software i2c, correcting returntype on i2c_init * Documentation updates. * Documentation updates * Documentation updates. * Documentation updates. * More documentation updates. * More doc updates. * fixing offset * Continuous servo support * More doc updates * Adding some spacing * Better Espressif support * Documentation updates. * Documentation updates. * Correcting tabs. Removing extraneous begin stuff. Almost code complete. * Lots of documentation updates, clarifications, and some better logging code. * Improved documentation. Corrected a few more things. Ready for release. * Last one Co-authored-by: NachtRaveVL <nachtravevl@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello ,
I tried something with a servo and a PCA9685 board by using the sketch underneath :
Everytime i want to compile i get the error:
'PCA9685_ServoEvaluator' does not name a type...
I downloaded the newest drive but the error remains .
I do not know how to go any further because i only started with Arduino this year ...
Can anyone put me on the right track in this one ?
Thans ,
Best regards ,
Luc
/*
Servo Motor Control using Arduino and PCA9685 Driver
by Dejan, https://howtomechatronics.com
*/
#include <Wire.h>
#include "PCA9685.h"
PCA9685 driver;
//PCA9685 outputs = 12-bit = 4096 steps
// 2.5% of 20ms = 0.5ms ; 12.5% of 20ms = 2.5ms
// 2.5% of 4096 = 102 steps; 12.5% of 4096 = 512 steps
PCA9685_ServoEvaluator pwmServo(102, 470); // (-90deg, +90deg)
// Second Servo
// PCA9685_ServoEvaluator pwmServo2(102, 310, 505); // (0deg, 90deg, 180deg)
void setup() {
Wire.begin(); // Wire must be started first
Wire.setClock(400000); // Supported baud rates are 100kHz, 400kHz, and 1000kHz
driver.resetDevices(); // Software resets all PCA9685 devices on Wire line
driver.init(B000000); // Address pins A5-A0 set to B000000
driver.setPWMFrequency(50); // Set frequency to 50Hz
}
void loop() {
driver.setChannelPWM(0, pwmServo.pwmForAngle(-90));
delay(1000);
driver.setChannelPWM(0, pwmServo.pwmForAngle(0));
delay(1000);
driver.setChannelPWM(0, pwmServo.pwmForAngle(90));
delay(1000);
}