Led blinking with sonar input


#1

RGBblink_sonar_inputsetting.sb2 (75.8 KB)

In the program attached, I have set the rgb LEDs switching time between blue and red as the value of the output from the sonar.
Now the sonar measures in cm. So if I place an object 10 cm from the sonar I should see 10 second frequency. However it takes longer…in fact it takes far too long . WHY ?

I tested the program for 10 second setting for the wait time. It works. I also checked for 0.1 time ultrasonic value, 0.01 times the ultrasonic value. It works. But it doesnt if I just set the actual value of the ultrasonic to the wait time…

Kindly clarifY WHY THIS SO PLEASE ?