|
Re: Gyro class issue?
Here it is. We can plug the gyro into AI port 1 and get voltage readings. When we plug it into port 0, we get nothing. We switching ports, eliminating the analog channel, and using other gyros.
import edu.wpi.first.wpilibj.smartdashboard.*;
import edu.wpi.first.wpilibj.Gyro
import edu.wpi.first.wpilibj.AnalogInput
public class Robot extends IterativeRobot
{
Gyro gyro = new gyro(1);
AnalogInput ai1 = new AnalogInput(0);
double angle1, voltage1;
public void robotInit()
{
gyro.reset();
}
public void autnoomousPeriodic()
{
}
public void teleopPeriodic()
{
angle1 = gyro.getAngle();
voltage1 = ai1.getAverageVoltage();
SmartDashboard.putString("DB/String 6","gyro = "+angle1);
SmartDashboard.putString("DB/String y","ai1 = "+voltage1);
}
}
|