Hello all. I’m finally all set up. I have all my parts I need for my first Arduino project! Right now, I’m dealing with an Arduino Uno, an HCSR04 Ultrasonic sensor and a mosfet and TI H-Bridge.
First off I’m trying to get my to Arduino to detect an object within two set distances using the same sensor. When an object is within a certain distance I am hoping to get it to trigger a both an H-bridge and a mosfet, but with different activation patterns when an object is between two different distances. Let me explain:
If an object is within 3-4 meters of the Sensor, I would like for the arduino to leave on the mosfet until the object is out of the path.
If an object proceeds to be within 1-2.9 meters of the sensor, I would like for the arduino to trigger the mosfet and h-bridge to turn off and on every 200 milliseconds until that object is out of the path or moved back to 3-4 meters away.
I’m not sure how to correspond all of these devices together using code, or how to set the distances to correspond. Is there anyone who can help? It would be greatly appreciated! Thank you!