View Single Post
  #12   Spotlight this post!  
Unread 27-01-2015, 16:01
acastagna acastagna is offline
Registered User
FRC #1493
 
Join Date: Jan 2012
Location: Albany High School
Posts: 35
acastagna is an unknown quantity at this point
Re: Gyro class issue?

Here's the code now. Still nothing. If I uncomment out the ai1.getVoltage I still get what looks like the proper voltage.



Code:
import edu.wpi.first.wpilibj.smartdashboard.*;
 import edu.wpi.first.wpilibj.Gyro
 import edu.wpi.first.wpilibj.AnalogInput

 public class Robot extends IterativeRobot
 {

   AnalogInput ai1 = new AnalogInput(0);
   Gyro gyro = new gyro(ai1);
 
    double angle1, voltage1;

    public void robotInit()
 {
    gyro.initGyro();
    gyro.reset();
    gyro.setSensitivity(0.007);
 }

 public void autnoomousPeriodic()
 {
 }

 public void teleopPeriodic()
 {
    angle1 = gyro.getAngle();
    // voltage1 = ai1.getAverageVoltage();
    SmartDashboard.putString("DB/String 6","gyro = "+angle1);
 }
Reply With Quote