Ligne 47 : |
Ligne 47 : |
| {{POLImage|Pololu-Zumo-Shield-Arduino-ajouter-detecteur-ligne-40.jpg|600px|Brochage du senseur}} | | {{POLImage|Pololu-Zumo-Shield-Arduino-ajouter-detecteur-ligne-40.jpg|600px|Brochage du senseur}} |
| | | |
− | The default I/O connections are to pins that are otherwise unused by the Zumo shield. The shield uses one digital I/O pin for each sensor (5, A2, A0, 11, A3, and 4), and if you add the LEDON shorting block, one additional pin (either A4 or 2) is used. To configure the ZumoReflectanceSensorArray library to use this default pinout, simply call init with no arguments: | + | The default I/O connections are to pins that are otherwise unused by the Zumo shield. The shield uses one digital I/O pin for each sensor (5, A2, A0, 11, A3, and 4), and if you add the LEDON shorting block, one additional pin (either A4 or 2) is used. To configure the [[Pololu-Zumo-Shield-Arduino-bibliotheque-Zumo|ZumoReflectanceSensorArray library]] to use this default pinout, simply call init with no arguments: |
| | | |
| + | <syntaxhighlight lang="c"> |
| + | reflectanceSensors.init(); |
| + | </syntaxhighlight> |
| + | |
| + | {{ambox|text=If you opt to leave off the LEDON shorting block, you should use the QTR_NO_EMITTER_PIN initialization parameter: reflectanceSensors.init(QTR_NO_EMITTER_PIN). Otherwise, the library code will still be trying to do something with the emitter pin (A4 or 2, depending on which Arduino you are using), and this would interfere with your being able to use that pin for alternate purposes.}} |
| + | |
| + | When soldering the male 2×12 header to the sensor array, you only need to solder those pins that you will be using. If you solder all 24 pins, the sensor array will be connected to additional pins from the Zumo shield’s front expansion area, though the array does not do anything with them in its default configuration: |
| + | |
| + | {{POLImage|Pololu-Zumo-Shield-Arduino-ajouter-detecteur-ligne-50.jpg|600px|Brochage du senseur}} |
| + | |
| + | === Désactivé et remapper le senseur === |
| + | Many applications do not require all six reflectance sensors, and you might want additional I/O lines for other things (e.g. obstacle detectors). In such cases, you can disable specific sensors and free up their associated I/O lines. The array PCB has six pairs of through holes, each of which corresponds to a different sensor. The order of the pairs matches the order of the sensors. When viewing the component side of the PCB, the right hole of each pair connects to an Arduino I/O line and the left hole connects to sensor. There is a single trace on the component side of the PCB between the two holes of each pair, and this trace can be cut to disable the sensor and free up the I/O line. The proper place to cut is marked on the silkscreen by carets. |
| + | |
| + | {{POLImage|Pololu-Zumo-Shield-Arduino-ajouter-detecteur-ligne-51.jpg|600px|couper la trace pour remapper}} |
| + | |
| + | For example, if you want to use your Zumo for solving a line maze, you can likely get by with just four sensors: you can use the middle two sensors for tracking the line and the outer two sensors for detecting intersections. To free up the I/O lines associated with the other two sensors, you could make the following modification: |
| + | |
| + | {{POLImage|Pololu-Zumo-Shield-Arduino-ajouter-detecteur-ligne-52.jpg|600px|couper la trace pour remapper}} |
| + | |
| + | Now you effectively have a four-sensor array and analog pins A2 and A3 are available for general-purpose use. To configure the ZumoReflectanceSensorArray library to use this new configuration, call init with these arguments: |
| + | |
| + | <syntaxhighlight lang="c"> |
| + | byte pins[] = {4, 11, A0, 5}; |
| + | reflectanceSensors.init(pins, 4); |
| + | </syntaxhighlight> |
| | | |
| {{traduction}} | | {{traduction}} |
| | | |
| {{Pololu-Zumo-Shield-Arduino-TRAILER}} | | {{Pololu-Zumo-Shield-Arduino-TRAILER}} |