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:
- When crane is initially powered up tracks move robot backwards for a few seconds.
- 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started