Modifications

Sauter à la navigation Sauter à la recherche
2 414 octets ajoutés ,  28 avril 2018 à 21:54
aucun résumé de modification
Ligne 1 : Ligne 1 :  
{{Pololu-Senseur-QTR-NAV}}
 
{{Pololu-Senseur-QTR-NAV}}
    +
== QTRSensor Command Reference ==
 
{{traduction}}
 
{{traduction}}
 +
 +
{{ambox|text=Previous versions of this library were named '''PololuQTRSensors''', but we have changed it to '''QTRSensors''' to differentiate it from the QTR sensor library in our [https://www.pololu.com/docs/0J17 Arduino Libraries for the Orangutan and 3pi Robot]. Aside from the library and class name changes, the new QTRSensors library is functionally identical to previous versions.}}
 +
 +
For QTR-xA sensors, you will want to instantiate a '''QTRSensorsAnalog''' object, and for QTR-xRC sensors you will want to instantiate a '''QTRSensorsRC''' object. Aside from the constructors, these two objects provide the same methods for reading sensor values (both classes are derived from the same abstract base class). The library provides access to the raw sensors values as well as to high level functions including calibration and line-tracking.
 +
 +
This section of the library defines an object for each of the two QTR sensor types, with the '''QTRSensorsAnalog''' class intended for use with QTR-xA sensors and the '''QTRSensorsRC''' class intended for use with QTR-xRC sensors. This library takes care of the differences between the QTR-xA and QTR-xRC sensors internally, providing you with a common interface to both sensors. The only external difference is in the constructors. This is achieved by having both of these classes derive from the abstract base class '''QTRSensors'''. This base class cannot be instantiated.
 +
 +
The QTRSensorsAnalog and QTRSensorsRC classes must be instantiated before they are used. This allows multiple QTR sensor arrays to be controlled independently as separate QTRSensors objects.
 +
 +
For calibration, memory is allocated using the {{fname|malloc()}} command. This conserves RAM: if all eight sensors are calibrated with the emitters both on an off, a total of 64 bytes would be dedicated to storing calibration values. However, for an application where only three sensors are used, and the emitters are always on during reads, only 6 bytes are required.
 +
 +
Internally, this library uses all standard Arduino functions such as micros() for timing and analogRead() or digitalRead() for getting the sensor values, so it should work on all Arduinos without conflicting with other libraries.
 +
 +
== Les fonctions ==
 +
=== read ===
 +
<syntaxhighlight lang="C">void read(unsigned int *sensorValues, unsigned char readMode = QTR_EMITTERS_ON)</syntaxhighlight>
 +
 +
xxx
    
{{Pololu-Senseur-QTR-TRAILER}}
 
{{Pololu-Senseur-QTR-TRAILER}}
29 917

modifications

Menu de navigation