Keywish Hummer-Bot-2.0 Instruction Manual page 55

Table of Contents

Advertisement

void
loop()
{
dl
= digitalRead(leftPin);
dr
= digitalRead(rightPin);
if
(dl
==
1
&&
dr
{
analogWrite(INPUT1_PIN,0);
analogWrite(INPUT2_PIN, 200);
analogWrite(INPUT3_PIN,0);
analogWrite(INPUT4_PIN, 200);
Serial.print(dl);
Serial.print("
Serial.print(dr);
Serial.print("
Serial.println("Turning
delay(300);
analogWrite(INPUT1_PIN,0);
analogWrite(INPUT2_PIN, 0);
analogWrite(INPUT3_PIN,0);
analogWrite(INPUT4_PIN, 0);
delay(1000);
//********************************************//Turning left
}
if (dl == 0 && dr == 0)
{
analogWrite(INPUT1_PIN,0);
analogWrite(INPUT2_PIN, 255); //the speed value of motorA is 255
analogWrite(INPUT3_PIN,0);
analogWrite(INPUT4_PIN, 255); //the speed value of motorB is 255
Serial.print(dl);
Serial.print("
Serial.print(dr);
Serial.print("
Serial.println("Turning around");
delay(500);
analogWrite(INPUT1_PIN,0);
analogWrite(INPUT2_PIN, 0);
analogWrite(INPUT3_PIN,0);
analogWrite(INPUT4_PIN, 0);
delay(1000); //********************************************//Turning around
}
if (dl == 0 && dr == 1)
== 0)
//the speed value of motorA is 180
//the speed value of motorB is 180
");
");
left");
");
");
52

Advertisement

Table of Contents
loading

Related Products for Keywish Hummer-Bot-2.0

Table of Contents