Obstacle Avoiding robot Query

I completed the section under Obstacle Avoiding robot and wrote a code to drive it accordingly. But when I uploaded that on Boltduino it does not perform the way it should.
I mean even if I put an object in front of the proximity sensor, it does not make any change to the movement of the robot.

Firstly I don’t know how it performs several other actions other than forward, reverse and left even if they are not written anywhere in the code. Second is direction of robot do not changes when an obstacle comes in the way.

Please help me to solve this issue.

The code which I wrote is :

void forward(){
digitalWrite(4, HIGH);
digitalWrite(12, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, LOW);

void reverse(){
digitalWrite(4, LOW);
digitalWrite(12, LOW);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);

void left(){
digitalWrite(7, HIGH);
digitalWrite(12, HIGH);
digitalWrite(4, LOW);
digitalWrite(8, LOW);

void setup(){

pinMode(11, INPUT);

pinMode(5, OUTPUT);
pinMode(4, OUTPUT);
pinMode(7, OUTPUT);

pinMode(6, OUTPUT);
pinMode(12, OUTPUT);
pinMode(8, OUTPUT);

digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
void loop(){



Thanks for patiently waiting for the reply.

Will get back regarding this by tomorrow EOD.

@yeshwant.naik sir, 4 days have elapsed. Till now I haven’t received any answer from your side. Please do tell the solution.

1 Like

Same problem, firstly the detector detects the obstacle when it is too close therefore hitting it and then only reversing, secondly after detecting an obstacle for the first time, first after reversing the obstacle LED turns on and then after turning also it turns on even when there is not obstacle; it then ends up in an endless loop.