QTR-8RC reflectance sensor (with Arduino Duemilanove)


(1) I am using QTR-8RC reflectance sensor with Arduino Duemilanove. I followed QTRRCExample.ino and I connected sensors 1 to 8 to digital pin 3 through 10. However, what I got is like this

Display values: 9 0 9 9 9 9 9 9
Sensors number: 7 8 1 2 3 4 5 6

The third “9” represents the first sensor and so on. Sensor eight never changes values (other sensors are calibrated successfully).

Can anyone tell me why this happen? Thanks!

(2) Also, I want to use the sensor to control a servo. I am going to use something similar to Arduino servo knob’s code. I am really new to Arduino and I do not know how to use the values I obtained to control the servo. That will be very helpful if someone can show me sample code about the control. Again thank you very much for all help!


Could you try displaying the raw sensor values of the array by using the call sensors.read() instead of sensors.readLine(). Also, could you post a simplified version of the code that should work but does not display the expected values.

For your second question, the Knob example is a great place to start. You can store the values you read with the QTR sensor and manipulate them to command the servo.

- Jeremy