Question: Solve problem: When crane is initially powered up tracks move robot backwards for a few seconds. When using the left joystick to move the robot

Solve problem:

  1. When crane is initially powered up tracks move robot backwards for a few seconds.
  2. When using the left joystick to move the robot in the left or right the robot does not move.

int in1=8; // motor one

int in3=9; // motor two

pinMode(in1,OUTPUT);

pinMode(in3,OUTPUT);

tempLH=Xbox.getAnalogHat(LeftHatY,0); //track

if(tempLH>deadZone||tempLH<(-deadZone))

{

if(tempLH>deadZone)

{

digitalWrite(in1,HIGH);

delay(25);

digitalWrite(in1,LOW); //LOW is CW

}

else

{

digitalWrite(in1,100);

delay(25);

digitalWrite(in1,LOW); //HIGH is CCW

}

}

tempRH=Xbox.getAnalogHat(LeftHatX,0); //track

if(tempRH>deadZone||tempRH<(-deadZone))

{

if(tempRH>deadZone)

{

digitalWrite(in1,HIGH);

delay(25);

digitalWrite(in1,LOW); //LOW is CW

//tempSpeed=tempRH-5;

}

else

{

digitalWrite(in3,100);

delay(25);

digitalWrite(in3,LOW);

//tempSpeed=abs(tempRH+5);

} //HIGH is CCW

//digitalWrite(in3,HIGH);

//towerSpeed=map(tempSpeed,10000,32763,50,2000);

//delayMicroseconds(10050-towerSpeed); //milli sec delay //Higher Number is slower speed

//digitalWrite(in1,LOW);

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!