I have a project for crash avoidance system for my rc car. Everything is running perfect but I have a small doubt. Here is the code as follows;
With this code, when ulstrasonic sensor detects an object, motor brakes immediatelly even if I push the throttle fully. After 2,5 seconds motor runs revers for 1,5 seconds slowly and go out of the u/s sensor range and I can use the transmitter as usual. That is what I wanted basically. However, despite there is no trigger action on transmitter if there is any object in the range of sensor motor runs revers. I know it acts what I wrote in the code but I want the ulstrasonic sensor runs when I use the transmitter ( forward action). So how should I upgrade/change my code in order to meet my a/m requirement. Any help, support will be appreciated.
There is nothing in code that can change the physical operation of your sensor. Look at the specifications for the sensor and you will find there is a "cone" of area that is scanned for reflections. As I recall it is 15 degrees wide. So anything within that area will cause a reflection and that is what you have proven.
In order to actually do what you want you will have to change sensors to an actual RADAR device that only has a tiny cone of response.
Add to the condition that controls the reverse response.
Test uzaklik, also test to see if the mapped value from the receiver is meaning throttle is active.
That would be escValue, can't be sure what value means go, but just don't go reverse if you aren't saying go forward over the remote. As well as seeing something ultrasonic in the way.