I want to make the vibration motor vibrate depending on the distance to an obstacle, for example if the distance is too short it should vibrate quickly and vice versa.
How can i make motor vibrate using arduino depending on the distance? Can you explain for me how can I use the delay in the vibration code? I found this code in the internet for vibration:
digitalWrite(y, HIGH); delay(50); digitalWrite(y, LOW); delay(50);
I know that I can change the delay, but how can we do it depending on our purpose? Please help me .. I don't know the use of the delay :(