With my HCSR04 can I set a mid range and a long range?

Hello! I understand that I can program my Arduino such to signal an LED on or off via an object >= maximum range or <=Maximum range.

Is there a way that I can program the arduino to pickup two separate ranges from the HCSR04 to run 3 separate functions?

IE:

=Maximum range-Led is off
=7 feet to maximum range-LED is on
<7 feet-LED is flashing?

Assuming maximum range has been defined, it can be done using if statements.

Without knowing the surrounding code, use 3 if statements.

However the the rest of the code may require these to be in a loop or other construct.

If > max
LED is off

If = 7 & <= max
LED is on

If <7
LED is flashing

Weedpharma