Hello to everyone,
i use a arduino Mega 2560, Tower Pro MG995(180° servo) and a SDM-I0 UART Sonic Sensor(4pin)
My idea is to build a robot who measure permanently the distance with the Ultra Sonic sensor. If the robot drives to an object he should stop and lookaround with the servo motor. The sensor of the robot should look first left save the sensor data in int= leftdist and after that turn to the right side to safe the distance there.
After that all he should compare with the distances and decide where is more space to drive.
Everything is working when i test it alone, but when i combine the two functions, the serial monitor gives me only the first measurement of the distance in the front, nothing else…
I hope you may help me, i sit on this projects now for weeks and i have no idea whats wrong.
Thank you a lot
Robot_Project.ino (4.42 KB)