package edu.wpi.first.wpilibj.templates;


import edu.wpi.first.wpilibj.AnalogChannel;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

/**
 * The VM is configured to automatically run this class, and to call the
 * functions corresponding to each mode, as described in the SimpleRobot
 * documentation. If you change the name of this class or the package after
 * creating this project, you must also update the manifest file in the resource
 * directory.
 */
public class RobotTemplate extends SimpleRobot {

    DigitalInput magdec = new DigitalInput(4);
    DigitalInput maginc = new DigitalInput(3);
    AnalogChannel absAngle = new AnalogChannel(1);
    /**
     * This function is called once each time the robot enters operator control.
     */
    public void operatorControl() {
        while(true) {
            // output voltage is ~4.1v. Conversion
            double angle = absAngle.getVoltage() * 360/4.9; 

            SmartDashboard.putBoolean("maginc", maginc.get());
            SmartDashboard.putBoolean("magdec", magdec.get());
            SmartDashboard.putNumber("voltage", absAngle.getVoltage());
            SmartDashboard.putNumber("angle", angle);
            System.out.println("voltage:" + absAngle.getVoltage());
        }

    }
}

@@ -232,326 +232,925 @@
 %0A%0A/*
-*
 %0A * Th
-e VM is configured to automatically run this class, and to call the%0A * functions corresponding to each mode, as described in the SimpleRobot%0A * documentation. If you change the name of this class or the package after%0A * creating this project, you must also update the manifest file in the resource%0A * directory.
+is class is used to test out the AS5145B encodder for absolute input%0A * via the pwm out put through a low-pass filter%0A * See the datasheet for instructions for wiring:%0A * http://www.ams.com/eng/content/download/50206/533867/34237%0A * From:%0A * http://www.ams.com/eng/Products/Magnetic-Position-Sensors/Magnetic-Rotary-Position-Sensors/AS5145B%0A * Wiring:%0A * one wire connected to a ground(GND pin) on the magnetic encoder to the analog breakout gnd(-)%0A * one wire going from the analog breakout power(pwr) to the 5v pin on the encoder%0A * one wire going from the PWM pin on the encoder to a low-pass filter to change the PWM output to analog and then from the low pass filter to the desired channel on the analog breakout on the cRIO%0A * optional wiring:%0A * one wire to each the Mag DECn pin and the Mag INCn for testing to a pin on the digital sidecar %0A * see section 4.1 of the manual for pin descriptions %0A * %0A * 
 %0A */

add wiring instructions