Durata de livrare: 1 - 3 zile lucratoare
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(' ');
}
Serial.println();
for (int i = 0; i < NUM_SENSORS; i++)
{
Serial.print(qtrrc.calibratedMaximumOn[i]);
Serial.print(' ');
}
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('t');
}
//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:
Linkuri:
Suport clienti Email tehnic si cereri de oferta B2B: contact@robofun.ro
+40 373 813 088 info@robofun.ro