Bara senzori linie digitali. include qtrsensors.h define NUM_SENSORS 8 number of sensors used define TIMEOUT 2500 waits for 2500 microseconds for sensor outputs to go low define EMITTER_PIN 2 emitter is controlled by digital pin 2 QTRSensorsRC qtrrc((unsigned char[]) { 3, 4, 5, 6, 7, 8, 9, 10} , NUM_SENSORS, TIMEOUT, EMITTER_PIN); unsigned int sensorValues[NUM_SENSORS]; void setup() { delay(500); pinMode(13, OUTPUT); digitalWrite(13, HIGH); for (int i 0; i 400; i++) { qtrrc.calibrate(); } digitalWrite(13, LOW); Serial.begin(9600); for (int i 0; i NUM_SENSORS; i++) { Serial.print(qtrrc.calibratedMinimumOn[i]); Serial.print( 39; 39;); } Serial.println(); for (int i 0; i NUM_SENSORS; i++) { Serial.print(qtrrc.calibratedMaximumOn[i]); Serial.print( 39; 39;); } Serial.println(); Serial.println(); delay(1000); } void loop() { read calibrated sensor values and obtain a measure of the line position from 0 to 5000 To get raw sensor values, call: qtrrc.read(sensorValues); instead of unsigned int position qtrrc.readLine(sensorValues); unsigned int position qtrrc.readLine(sensorValues); print the sensor values as numbers from 0 to 1000, where 0 means maximum reflectance and 1000 means minimum reflectance, followed by the line position for (unsigned char i 0; i NUM_SENSORS; i++) { Serial.print(sensorValues[i]); Serial.print( 39;t 39;); } Serial.println(); uncomment this line if you are using raw values Serial.println(position); comment this line out if you are using raw values delay(250); } Specificatii: Dimensiuni : 74.93 x 12.7 x 3.04 mm Tensiunea de alimentare : 3.3-5V Curent : 100mA Output : 8 digital pulse Distanta optima : 3mm Distanta maxima : 9 mm Greutate : 3.09 g Linkuri: Pagina producatorului
Related products
Accelerometru
Lumina