I have the Pololu QTR-6A(Analog) in this case, as i snapped the two optional sensors off the end and am using the 6 sensors. I just bought this thing yesterday and i've tried to throw some code together based on the pololu site's instructions, But my Serial reads all 0's every time.
I have the Vcc from the sensor board hooked up to my +5V on my Arduino Duemillanove, Ground to Ground, the LEDON from the sensor array is on Digital Pin 5, which i set to HIGH in my code. And the 6 Signal wires from the sensor board are hooked to my Analog pins 0 - 5 respectively on the Arduino.
unsigned int sensor[6]; int position = qtra.readLine(sensor); digitalWrite(5, HIGH); Serial.print(qtra.readLine(sensor));
**Serial.println(); ** delay(50);
}
Again, The problem is that my Serial reads all 0's, every time.
I'm having sort of the same problem. Trying to setup the same 6 sensors into an array. Haven't figured that one out yet. I am able to get a sensor reading to the serial port though.
I'll post later with the code I made for it.
At work now.
Okay here is the code I'm using and I get the serial out and the numbers to the serial monitor in Arduino 16.
I borrowed it from the servo example in the playground and added the serial to see the numbers.
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int pos = 0; // variable to store the servo position
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
Serial.begin(19200);
}
void loop()
{
digitalWrite(10, HIGH);
pos = analogRead(0);
pos = map(pos, 0, 1023, 0, 180);
myservo.write(pos); // tell servo to go to position in variable 'pos'
Serial.println(pos);
delay(15); // waits 15ms for the servo to reach the position
}
Maybe that helps?
I can't get the PololuQTRSensors.h to work so I can calibrate them. Can you get this working? When I compile is says: "error 30 PololyQTRSensors.h: No such file or directory." I unzipped it to the library folder under hardware.
I just figured it out. I have to put the folder that contains the header file into the library folder and not in another folder that was containing the other things that came with it.
Okay I see your point, now that I got my folder problem fixed I am getting the same all zeros streaming down the left side for the calibration. I'm working on it too.