# Plusieurs HC-SR04

**URL:** <https://forum.arduino.cc/t/plusieurs-hc-sr04/1208168>\
**Category:** Français\
**Created:** [January 7, 2024, 4:36pm UTC](https://forum.arduino.cc/t/plusieurs-hc-sr04/1208168 "2024-01-07T16:36:13Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![lesept](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/lesept/32/238959_2.png) [@lesept](https://forum.arduino.cc/u/lesept)\
**Post date:** [January 7, 2024, 4:48pm UTC](https://forum.arduino.cc/t/plusieurs-hc-sr04/1208168/2 "2024-01-07T16:48:22Z")

</div>

En cherchant un peu, on trouve qu'à peu près tout est possible.

Par exemple, ici, avec la bibliothèque NewPing, il est possible de connecter ensemble le Trig et l'echo d'un même capteur :

> **[Ultrasonic Sensors - Bot Blog](https://andrewjkramer.net/ultrasonic-sensors/)**
>
> A tutorial on using ultrasonic sensors with Arduino. Includes wiring diagrams and example code.

Ici, le post numéro 3 montre un exemple (un peu complexe) avec plusieurs capteurs : chacun a sa propre pin pour l'écho et tous partagent le même trigger.

> [@Multiple HC-SR04 with as few pins as possible](https://forum.arduino.cc/t/multiple-hc-sr04-with-as-few-pins-as-possible/475135/3):
>
> sparknburn: Hi, I want to connect multiple ultra sonic sensors using as few pins as possible on the arduino. Since they can't CAN be triggered at the same time .... I have succeeded in triggering all at the same time using interrupts slight_smile #define TriggerPin &nbsp;2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// output pin all trigger pins are linked to. #define SamplesToAverage 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // number of ping samples to average together for use #define DelayBetweenPings 15 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// delay after ping data is…

---

_[View the full topic](https://forum.arduino.cc/t/plusieurs-hc-sr04/1208168)._
