Light installation strobe interval advice with HC-S04 sensors: pics&code incl.

You really should use the NewPing library...it allows you to:

  • ping very quickly (sez up to 30 Hz)
  • set a maximum distance where pings beyond that distance are read as no ping
  • eliminates the one second delay from pulseIn
  • makes your code cleaner and more compact
  • allows you to easily use a median reading (to eliminate the occasional bogus hit)

etc., etc., etc.

Read about it here and here.

Also, how far apart are your sensors and where are they pointing? They may be interfering with each other.