I just purchased a qtr-8rc sensor and I have been going through all of the examples from this site and others and no matter what code I use it always errors at this line.
QTRSensorsRC qtrrc((unsigned char[]) {bla bla bla…
The error in arduino is:
line:7: error: ‘QTRSensorsRC’ does not name a type
line:7: error: expected unqualified-id before ‘,’ token
line:7: error: expected unqualified-id before numeric constant
line.cpp: In function ‘void loop()’:
line:19: error: ‘qtrrc’ was not declared in this scope
I have tried all types of solutions and it continues to error
- installed different versions of arduino 1.0 - 1.0.5
- changed the locations of the library QTRSensors.h, (this can change the error but it still errors)
- tried different examples, all do the same thing
I am very new and I am sure I am doing something simple wrong but I am lost. I have searched and searched and I can not find anyone else having this problem.
Any help would be appreciated
Here is the code I just ran very simple QTRSensors.h is straight from this site.
#include <QTRSensors.h>
// create an object for your type of sensor (RC or Analog)
// in this example we have three sensors on analog inputs 0 - 2, a.k.a. digital pins 14 - 16
QTRSensorsRC qtr((char[]) {14, 15, 16}, 3);
// QTRSensorsA qtr((char[]) {0, 1, 2}, 3);
void setup()
{
// optional: wait for some input from the user, such as a button press
// then start calibration phase and move the sensors over both
// reflectance extremes they will encounter in your application:
int i;
for (i = 0; i < 250; i++) // make the calibration take about 5 seconds
{
qtr.calibrate();
delay(20);
}
// optional: signal that the calibration phase is now over and wait for further
// input from the user, such as a button press
}