I am planning to build robot like irobot Roomba. So cleaning in a spiral pattern is required like the image shown starting from the center:
This code is part of my full code which doesn't give me spiral pattern:
void spiralling() {
for(int i=0;i<=2;i++) {
digitalWrite(motor1,HIGH);
digitalWrite(motor2,LOW);
digitalWrite(motor3,HIGH);
digitalWrite(motor4,LOW);
analogWrite(pwm1,180);
analogWrite(pwm2,80);
delay(300);
p=1;
}
analogWrite(pwm2,250);
delay(150);
}
So my question is how can I make my bot trace spiral pattern (algorithm?,Logic? to use), as the only way to change the direction is with two wheels on sides.
Is there any code which constantly increases the radius of bot movement from center to radially outwards?
My robot has arduino uno ,l293d motordriver,two geared motors on either sides as shown in image and castor wheel in front: