I am trying to understand the sample code below to implement the sensor into my project.
#define NUM_SENSORS 1 // number of sensors used
#define NUM_SAMPLES_PER_SENSOR 4 // average 4 analog samples per sensor reading
#define EMITTER_PIN 2 // emitter is controlled by digital pin 2
// sensors 0 through 5 are connected to analog inputs 0 through 5, respectively
QTRSensorsAnalog qtra((unsigned char[]) {2,},
NUM_SENSORS, NUM_SAMPLES_PER_SENSOR, EMITTER_PIN);
unsigned int sensorValues[NUM_SENSORS];
void setup()
{
delay(500);
Serial.begin(9600); // set the data rate in bits per second for serial data transmission
delay(1000);
}
void loop()
{
// read raw sensor values
qtra.read(sensorValues);
// print the sensor values as numbers from 0 to 1023, where 0 means maximum reflectance and
// 1023 means minimum reflectance
for (unsigned char i = 0; i < NUM_SENSORS; i++)
{
Serial.print(sensorValues[i]);
// Serial.print('\t'); // tab to format the raw data into columns in the Serial monitor
Serial.print("Sensing...");
}
Serial.println();
delay(250);
}
I have two questions,
1: what exactly does the line in the code below do?
for (unsigned char i = 0; i < NUM_SENSORS; i++)