Call:      DistanceBetween (String Tag, int low, int High ) 

Input:    Tagname, Lower value, Higher Value 

Output: boolean


The value for the selected ultrasonic[1], associated with the Tagname is checked on the lower and higher value. So when the measured distance is between or equal to one of the two values, the function result is true when called in the cycle.



Status = DistanceBetween(“BIRD1”,10,100);


[1] The NewPing library is made in such a way that the declaration of the sensor is made by a constructor; meaning that the sensor is made and initialized during the declaration. All needed sensors are normally made during declaration.

To keep some sort of standard for the FSM sketch, software for the ultrasonic sensors is now made like all other I/O, e.g. defining the number of sensors, the start of the first pin and the tagnames of the Ultrasonic devices. To make this work, the sensor is declared for each measurement (void UltraSonicDevice). The sensor will be declared, makes the measurement and is deleted again. All information necessary for declaring the sensor is made during the initialization phase (like the information needed for all other I/O). It is not the most beautiful way of programming, but keeping up the standard is also a good reason for making it like this and most important; it works.