Infrared Tracing - Keywish Hummer-Bot-2.0 Instruction Manual

Table of Contents

Advertisement

{
analogWrite(INPUT1_PIN,180);//the speed value of motorA is val
analogWrite(INPUT2_PIN, 0);
analogWrite(INPUT3_PIN,180);//the speed value of motorA is val
analogWrite(INPUT4_PIN, 0);
Serial.print(dl);
Serial.print("
Serial.print(dr);
Serial.print("
Serial.println("Turning right");
delay(300);
analogWrite(INPUT1_PIN,0);
analogWrite(INPUT2_PIN, 0);
analogWrite(INPUT3_PIN,0);
analogWrite(INPUT4_PIN, 0);
delay(1000); //********************************************//Turning right
}
if (dl == 1 && dr == 1)
{
analogWrite(INPUT1_PIN,180);//the speed value of motorA is val
analogWrite(INPUT2_PIN, 0);
analogWrite(INPUT3_PIN,0);
analogWrite(INPUT4_PIN, 180); //the speed value of motorB is val
Serial.print(dl);
Serial.print("
Serial.print(dr);
Serial.print("
Serial.println("go");//********************************************//forward
}
}
In the above program, we made comments on some part of the program in order to make you to learn and
understand the program easily, the program is relatively simple, you can write your own programs to give the
car more skills. Of course, if you want to use it directly, we have the corresponding source program in the CD.

3.2.3 Infrared Tracing

3.2.3.1 Introduction of Infrared Tracing Sensor
After infrared obstacle avoidance, let us learn the infrared tracing, their nature of work is the same, using
basically the same module, just in different ways, to achieve different functions.
we have to pay attention to the color of the line we trace (the black line or white line), if your floor is black,
you should trace the white line (pasting white line on the floor); if it is white, then you should trace the black
");
");
");
");
53
In this section when we study,

Advertisement

Table of Contents
loading

Table of Contents