Skip to main content

Posts

Line Following Obstacle Avoiding Maze solving Robot part 6

Line Following Obstacle Avoiding Maze solving Robot part 6 PART1 System Design PART2  Mechanical design PART3 Motor control PART4 Electronic integration PART5 Software development  PART6 Final Code Continue from Part 5 Encoder program: int motor_left[] = {11, 10}; int motor_right[] = {12, 13}; int a, count2=0,count=0,count1=0;; int last=0; float t; float s; void setup() { Serial.begin(9600); for (int i = 0; i < 2; i++) { pinMode(motor_left[i], OUTPUT); pinMode(motor_right[i], OUTPUT); } pinMode(A1,INPUT); pinMode(A3,INPUT); // initialize serial communication at 9600 bits per second: // Serial.begin(9600); } // the loop routine runs over and over again forever: void loop() { int sensorValue = analogRead(A3); int sensorValue1 = analogRead(A1); // read the input on analog pin 0: if(count>19) { t=millis(); t=t/1000; Serial.println(t); s=(220/t); Serial.println("speed="); Se...